Yao e4dfc9e48c
[new feature] Layout: 新增 layout 组件 (#43)
* change example dir

* Update README.md

更新预览教程

* 新增 layout 组件

* exclude example

* change .wxss -> .pcss

* 脚本目录更名为 scripts
2017-10-31 17:41:31 +08:00

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);
}
}
}));