Yao 31e9bb83e8
[new feature] Actionsheet: 新增行动按钮组件 (#97)
* actionsheet init

* actionsheet process

* action sheet 功能补齐

* 增加 actionsheet readme

* 增加示例入口

* 增加标题配置
2018-01-01 16:41:30 +08:00

42 lines
1.2 KiB
JavaScript

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 回调函数');
}
}