// components/myButton/myButton.js Component({ options: { styleIsolation: 'apply-shared' }, behaviors: ['wx://form-field-button'], /** * 组件的属性列表 */ properties: { size: String, type: String, disabled: Boolean, formType: String, openType: String }, lifetimes: { attached: function () { if (this.data.type !== 'default' && this.data.type !== 'primary') { this.setData({ type: 'default' }) } if (this.data.size !== 'default' && this.data.size !== 'large' && this.data.size !== 'mini') { this.setData({ size: 'default' }) } } }, /** * 组件的初始数据 */ data: { }, /** * 组件的方法列表 */ methods: { } })