mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
* change example dir * Update README.md 更新预览教程 * 新增 layout 组件 * exclude example * change .wxss -> .pcss * 脚本目录更名为 scripts
37 lines
737 B
JavaScript
37 lines
737 B
JavaScript
var Zan = require('../../dist/index');
|
|
|
|
Page(Object.assign({}, Zan.Switch, {
|
|
data: {
|
|
sync: {
|
|
checked: false
|
|
},
|
|
async: {
|
|
checked: true,
|
|
loading: false
|
|
},
|
|
},
|
|
|
|
handleZanSwitchChange(e) {
|
|
var componentId = e.componentId;
|
|
var checked = e.checked;
|
|
|
|
if (componentId == 'sync') {
|
|
// 同步开关
|
|
this.setData({
|
|
[`${componentId}.checked`]: checked
|
|
});
|
|
} else if (componentId == 'async') {
|
|
// 异步开关
|
|
this.setData({
|
|
[`${componentId}.loading`]: true
|
|
});
|
|
setTimeout(() => {
|
|
this.setData({
|
|
[`${componentId}.loading`]: false,
|
|
[`${componentId}.checked`]: checked
|
|
});
|
|
}, 500);
|
|
}
|
|
}
|
|
}));
|