index.coffee 1001 B

123456789101112131415161718192021222324252627282930313233
  1. # app/components/UI/Notification/index.coffee
  2. # Добавление стилей компонента
  3. if globalThis.stylFns and globalThis.stylFns['app/components/UI/Notification/index.styl']
  4. styleElement = document.createElement('style')
  5. styleElement.type = 'text/css'
  6. styleElement.textContent = globalThis.stylFns['app/components/UI/Notification/index.styl']
  7. document.head.appendChild(styleElement)
  8. else
  9. log '⚠️ Стили уведомлений не найдены'
  10. module.exports =
  11. name: 'notification-container'
  12. props:
  13. notifications:
  14. type: Array
  15. default: -> []
  16. methods:
  17. closeNotification: (id) ->
  18. @$emit 'close-notification', id
  19. formatTime: (timestamp) ->
  20. return '' unless timestamp
  21. date = new Date(timestamp)
  22. date.toLocaleTimeString('ru-RU', {
  23. hour: '2-digit',
  24. minute: '2-digit'
  25. })
  26. render: (new Function '_ctx', '_cache', globalThis.renderFns['app/components/UI/Notification/index.pug'])()