Рефакторинг
This commit is contained in:
@@ -1,53 +1,39 @@
|
|||||||
export function success(vue, message, caption) {
|
export function notify(vue, opts) {
|
||||||
caption = (caption ? `<div style="font-size: 120%; color: black"><b>${caption}</b></div><br>` : '');
|
let {
|
||||||
|
caption = null,
|
||||||
|
captionColor = 'black',
|
||||||
|
color = 'positive',
|
||||||
|
icon = '',
|
||||||
|
iconColor = 'white',
|
||||||
|
message = '',
|
||||||
|
messageColor = 'black',
|
||||||
|
} = opts;
|
||||||
|
|
||||||
|
caption = (caption ? `<div style="font-size: 120%; color: ${captionColor}"><b>${caption}</b></div><br>` : '');
|
||||||
return vue.$q.notify({
|
return vue.$q.notify({
|
||||||
position: 'top-right',
|
position: 'top-right',
|
||||||
color: 'positive',
|
color,
|
||||||
textColor: 'white',
|
textColor: iconColor,
|
||||||
icon: 'o_check_circle',
|
icon,
|
||||||
actions: [{icon: 'o_close', color: 'black'}],
|
actions: [{icon: 'o_close', color: 'black'}],
|
||||||
html: true,
|
html: true,
|
||||||
|
|
||||||
message:
|
message:
|
||||||
`<div style="max-width: 350px;">
|
`<div style="max-width: 350px;">
|
||||||
${caption}
|
${caption}
|
||||||
<div style="color: black; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
|
<div style="color: ${messageColor}; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
|
||||||
</div>`
|
</div>`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function success(vue, message, caption) {
|
||||||
|
notify(vue, {color: 'positive', icon: 'o_check_circle', message, caption});
|
||||||
|
}
|
||||||
|
|
||||||
export function error(vue, message, caption) {
|
export function error(vue, message, caption) {
|
||||||
caption = (caption ? `<div style="font-size: 120%; color: yellow"><b>${caption}</b></div><br>` : '');
|
notify(vue, {color: 'negative', icon: 'o_error_outline', messageColor: 'yellow', message, caption});
|
||||||
return vue.$q.notify({
|
|
||||||
position: 'top-right',
|
|
||||||
color: 'negative',
|
|
||||||
textColor: 'white',
|
|
||||||
icon: 'o_error_outline',
|
|
||||||
actions: [{icon: 'o_close', color: 'black'}],
|
|
||||||
html: true,
|
|
||||||
|
|
||||||
message:
|
|
||||||
`<div style="max-width: 350px;">
|
|
||||||
${caption}
|
|
||||||
<div style="color: yellow; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
|
|
||||||
</div>`
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function info(vue, message, caption) {
|
export function info(vue, message, caption) {
|
||||||
caption = (caption ? `<div style="font-size: 120%; color: black"><b>${caption}</b></div><br>` : '');
|
notify(vue, {color: 'info', icon: 'o_notifications', message, caption});
|
||||||
return vue.$q.notify({
|
|
||||||
position: 'top-right',
|
|
||||||
color: 'info',
|
|
||||||
textColor: 'white',
|
|
||||||
icon: 'o_notifications',
|
|
||||||
actions: [{icon: 'o_close', color: 'black'}],
|
|
||||||
html: true,
|
|
||||||
|
|
||||||
message:
|
|
||||||
`<div style="max-width: 350px;">
|
|
||||||
${caption}
|
|
||||||
<div style="color: black; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
|
|
||||||
</div>`
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user