index.js
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const { extractComponentId } = require('../common/helper');
module.exports = {
_handleZanActionsheetMaskClick({ currentTarget = {} }) {
const dataset = currentTarget.dataset || {};
const { componentId, closeOnClickOverlay } = dataset;
// 判断是否在点击背景时需要关闭弹层
if (!closeOnClickOverlay) {
return;
}
resolveCancelClick.call(this, { componentId });
},
_handleZanActionsheetCancelBtnClick(e) {
const componentId = extractComponentId(e);
resolveCancelClick.call(this, { componentId });
},
_handleZanActionsheetBtnClick({ currentTarget = {} }) {
const dataset = currentTarget.dataset || {};
const { componentId, index } = dataset;
if (this.handleZanActionsheetClick) {
this.handleZanActionsheetClick({ componentId, index });
} else {
console.warn('页面缺少 handleZanActionsheetClick 回调函数');
}
}
};
function resolveCancelClick({ componentId }) {
console.info('[zan:actionsheet:cancel]');
if (this.handleZanActionsheetCancel) {
this.handleZanActionsheetCancel({ componentId });
} else {
console.warn('页面缺少 handleZanActionsheetCancel 回调函数');
}
}