WyTiny 9480e01b9b [refactor] Actionsheet: 升级到自定义组件 (#175)
* fix: temp commit

* fix: temp commit

* fix: add custom actionsheet
2018-04-02 22:24:01 +08:00

37 lines
701 B
JavaScript

Component({
externalClasses: ['mask-class', 'container-class'],
properties: {
actions: {
type: Array,
value: []
},
show: {
type: Boolean,
value: false
},
cancelWithMask: {
type: Boolean,
value: true
},
cancelText: {
type: String,
value: ''
}
},
methods: {
onMaskClick() {
if (this.data.cancelWithMask) {
this.cancelClick();
}
},
cancelClick() {
this.triggerEvent('cancel');
},
handleBtnClick({ currentTarget = {} }) {
const dataset = currentTarget.dataset || {};
const { index } = dataset;
this.triggerEvent('actionclick', { index });
}
}
});