button.d.ts.map 2.9 KB

1
  1. {"version":3,"sources":["../src/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,qBAAqB,CAAC;AASlE,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,cAAc;IAChD,eAAe,WAA0E;IAEzF,SAAS,WAA8D;IAGvE,UAAU,iCAAS;IAGnB,IAAI;;;;MAKF;IAEF,SAAS;;MAIP;IAGF,SAAS;;MAaP;IAGF,OAAO;;;;;;;;;MAmDL;CACH","file":"button.d.ts","sourcesContent":["import { SuperComponent, wxComponent } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\nimport { canIUseFormFieldButton } from '../common/version';\n\nconst { prefix } = config;\nconst name = `${prefix}-button`;\n\n@wxComponent()\nexport default class Button extends SuperComponent {\n externalClasses = [`${prefix}-class`, `${prefix}-class-icon`, `${prefix}-class-loading`];\n\n behaviors = canIUseFormFieldButton() ? ['wx://form-field-button'] : [];\n\n // 组件的对外属性\n properties = props;\n\n // 组件的内部数据\n data = {\n // 按钮样式列表\n prefix,\n className: '',\n classPrefix: name,\n };\n\n observers = {\n 'theme, size, plain, block, shape, disabled, loading'() {\n this.setClass();\n },\n };\n\n /* 组件生命周期 */\n lifetimes = {\n // 组件实例被创建\n // created() {},\n // 组件实例进入页面节点树\n attached() {\n this.setClass();\n },\n // 页面组件初始化完成\n // ready() { },\n // 组件实例被移动到节点树另一个位置\n // moved() {},\n // 组件实例被从页面节点树移除\n // detached() { },\n };\n\n /* Methods */\n methods = {\n setClass() {\n const classList = [\n name,\n `${prefix}-class`,\n `${name}--${this.data.theme || 'default'}`,\n `${name}--size-${this.data.size.slice(0, 1)}`,\n ];\n\n classList.push(`${name}--${this.data.shape}`);\n\n if (this.data.block) {\n classList.push(`${prefix}-is-block`);\n }\n if (this.data.disabled) {\n classList.push(`${prefix}-is-disabled`);\n }\n // if (this.data.loading) {\n // classList.push(`${prefix}-is-loading`);\n // }\n classList.push(`${name}--${this.data.variant}`);\n if (this.data.ghost) {\n classList.push(`${name}--ghost`);\n }\n this.setData({\n className: classList.join(' '),\n });\n },\n getuserinfo(e) {\n this.triggerEvent('getuserinfo', e.detail);\n },\n contact(e) {\n this.triggerEvent('contact', e.detail);\n },\n getphonenumber(e) {\n this.triggerEvent('getphonenumber', e.detail);\n },\n error(e) {\n this.triggerEvent('error', e.detail);\n },\n opensetting(e) {\n this.triggerEvent('opensetting', e.detail);\n },\n launchapp(e) {\n this.triggerEvent('launchapp', e.detail);\n },\n handleTap(e) {\n if (this.data.disabled) return;\n\n this.triggerEvent('tap', e.detail);\n },\n };\n}\n"]}