notify.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. export function success(vue, message, caption) {
  2. caption = (caption ? `<div style="font-size: 120%; color: black"><b>${caption}</b></div><br>` : '');
  3. return vue.$q.notify({
  4. position: 'top-right',
  5. color: 'positive',
  6. textColor: 'white',
  7. icon: 'o_check_circle',
  8. actions: [{icon: 'o_close', color: 'black'}],
  9. html: true,
  10. message:
  11. `<div style="max-width: 350px;">
  12. ${caption}
  13. <div style="color: black; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
  14. </div>`
  15. });
  16. }
  17. export function error(vue, message, caption) {
  18. caption = (caption ? `<div style="font-size: 120%; color: yellow"><b>${caption}</b></div><br>` : '');
  19. return vue.$q.notify({
  20. position: 'top-right',
  21. color: 'negative',
  22. textColor: 'white',
  23. icon: 'o_error_outline',
  24. actions: [{icon: 'o_close', color: 'black'}],
  25. html: true,
  26. message:
  27. `<div style="max-width: 350px;">
  28. ${caption}
  29. <div style="color: yellow; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
  30. </div>`
  31. });
  32. }
  33. export function info(vue, message, caption) {
  34. caption = (caption ? `<div style="font-size: 120%; color: black"><b>${caption}</b></div><br>` : '');
  35. return vue.$q.notify({
  36. position: 'top-right',
  37. color: 'info',
  38. textColor: 'white',
  39. icon: 'o_notifications',
  40. actions: [{icon: 'o_close', color: 'black'}],
  41. html: true,
  42. message:
  43. `<div style="max-width: 350px;">
  44. ${caption}
  45. <div style="color: black; overflow-wrap: break-word; word-wrap: break-word;">${message}</div>
  46. </div>`
  47. });
  48. }