@mirari/mp-common
Version:
小程序公共库
35 lines (33 loc) • 745 B
JavaScript
Component({
externalClasses: ['form-button-class'],
properties: {
disabled: {
type: Boolean,
value: false
},
submitFormMethod: {
type: String,
value: 'submitForm'
},
submitFormIdSwitch: {
type: Boolean,
value: true
}
},
data: {
},
methods: {
onSubmit (e) {
if (this.data.submitFormIdSwitch) {
this.triggerEvent('btn-tap')
getApp().globalData[this.data.submitFormMethod](e.detail.formId).then(() => {
console.log('btn tap submit formid succ', e.detail.formId)
}).catch((e) => {
console.error('btn tap submit formid fail', e)
})
} else {
this.triggerEvent('btn-tap', e.detail)
}
}
}
})