mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
* actionsheet init * actionsheet process * action sheet 功能补齐 * 增加 actionsheet readme * 增加示例入口 * 增加标题配置
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
const { Actionsheet, extend } = require('../../dist/index');
|
|
|
|
Page(extend({}, Actionsheet, {
|
|
data: {
|
|
baseActionsheet: {
|
|
show: false,
|
|
cancelText: '关闭 Action',
|
|
closeOnClickOverlay: true,
|
|
componentId: 'baseActionsheet',
|
|
actions: [{
|
|
name: '选项1',
|
|
subname: '选项描述语1',
|
|
className: 'action-class',
|
|
loading: false
|
|
}, {
|
|
name: '选项2',
|
|
subname: '选项描述语2',
|
|
className: 'action-class',
|
|
loading: false
|
|
}]
|
|
}
|
|
},
|
|
|
|
toggleActionsheet() {
|
|
this.setData({
|
|
'baseActionsheet.show': true
|
|
});
|
|
},
|
|
|
|
handleZanActionsheetCancel({ componentId }) {
|
|
this.setData({
|
|
[`${componentId}.show`]: false
|
|
});
|
|
},
|
|
|
|
handleZanActionsheetClick({ componentId, index }) {
|
|
console.log(`item index ${index} clicked`);
|
|
|
|
this.setData({
|
|
[`${componentId}.actions[${index}].loading`]: true
|
|
});
|
|
|
|
setTimeout(() => {
|
|
this.setData({
|
|
[`${componentId}.show`]: false,
|
|
[`${componentId}.actions[${index}].loading`]: false
|
|
});
|
|
}, 1500);
|
|
}
|
|
|
|
}));
|