linrz 9f173eac00 docs(Button/Cell/Checkbox/Radio): update some examples (#2576)
* docs: complete some examples of  button/cell/checbox/radio

* docs: update button text

* docs: add some usage of button/cell/checbox/radio
2019-12-23 10:14:26 +08:00

39 lines
831 B
JavaScript

import Page from '../../common/page';
Page({
data: {
checkbox1: true,
checkbox2: true,
checkbox3: true,
checkboxLabel: true,
checkboxSize: true,
checkboxShape: true,
list: ['a', 'b', 'c'],
result: ['a', 'b'],
result2: [],
result3: [],
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png'
},
onChange(event) {
const { key } = event.currentTarget.dataset;
this.setData({ [key]: event.detail });
},
onClick(event) {
const { value } = event.currentTarget.dataset;
this.setData({
radio3: value
});
},
toggle(event) {
const { index } = event.currentTarget.dataset;
const checkbox = this.selectComponent(`.checkboxes-${index}`);
checkbox.toggle();
},
noop() {}
});