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EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;YACvC,CAAC;YACD,WAAW,CAAC,CAAC;gBACX,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;YAC7C,CAAC;YACD,SAAS,CAAC,CAAC;gBACT,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;YAC3C,CAAC;YACD,SAAS,CAAC,CAAC;gBACT,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ;oBAAE,OAAO;gBAE/B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CAAA,CAAA;AA3FoB,MAAM;IAD1B,WAAW,EAAE;GACO,MAAM,CA2F1B;eA3FoB,MAAM","file":"button.js","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"]}
|