| 1234567891011121314151617181920212223242526272829303132333435363738 |
- # app/components/UI/Button/index.coffee
- # Добавление стилей компонента
- if globalThis.stylFns and globalThis.stylFns['app/components/UI/Button/index.styl']
- styleElement = document.createElement('style')
- styleElement.type = 'text/css'
- styleElement.textContent = globalThis.stylFns['app/components/UI/Button/index.styl']
- document.head.appendChild(styleElement)
- else
- log '⚠️ Стили кнопки не найдены'
- module.exports =
- name: 'ui-button'
- props:
- type:
- type: String
- default: 'primary'
- validator: (value) ->
- ['primary', 'secondary', 'success', 'danger', 'outline'].includes(value)
- size:
- type: String
- default: 'medium'
- validator: (value) ->
- ['small', 'medium', 'large'].includes(value)
- disabled:
- type: Boolean
- default: false
- loading:
- type: Boolean
- default: false
- methods:
- handleClick: (event) ->
- if not @disabled and not @loading
- @$emit 'click', event
- render: (new Function '_ctx', '_cache', globalThis.renderFns['app/components/UI/Button/index.pug'])()
|