index.coffee 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # app/components/UI/Button/index.coffee
  2. # Добавление стилей компонента
  3. if globalThis.stylFns and globalThis.stylFns['app/components/UI/Button/index.styl']
  4. styleElement = document.createElement('style')
  5. styleElement.type = 'text/css'
  6. styleElement.textContent = globalThis.stylFns['app/components/UI/Button/index.styl']
  7. document.head.appendChild(styleElement)
  8. else
  9. log '⚠️ Стили кнопки не найдены'
  10. module.exports =
  11. name: 'ui-button'
  12. props:
  13. type:
  14. type: String
  15. default: 'primary'
  16. validator: (value) ->
  17. ['primary', 'secondary', 'success', 'danger', 'outline'].includes(value)
  18. size:
  19. type: String
  20. default: 'medium'
  21. validator: (value) ->
  22. ['small', 'medium', 'large'].includes(value)
  23. disabled:
  24. type: Boolean
  25. default: false
  26. loading:
  27. type: Boolean
  28. default: false
  29. methods:
  30. handleClick: (event) ->
  31. if not @disabled and not @loading
  32. @$emit 'click', event
  33. render: (new Function '_ctx', '_cache', globalThis.renderFns['app/components/UI/Button/index.pug'])()