docs(Checkbox): reduce unnecessary reactive

This commit is contained in:
chenjiahan 2020-12-09 10:43:22 +08:00
parent f354513f9e
commit a2dbf043a1
3 changed files with 10 additions and 14 deletions

View File

@ -76,17 +76,15 @@ Use icon slot to custom icon.
```
```js
import { toRefs, reactive } from 'vue';
import { ref } from 'vue';
export default {
setup() {
const state = reactive({
checked: true,
const checked = ref(true);
return {
checked,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
});
return {
...toRefs(state),
};
},
};

View File

@ -88,17 +88,15 @@ export default {
```
```js
import { toRefs, reactive } from 'vue';
import { ref } from 'vue';
export default {
setup() {
const state = reactive({
checked: true,
const checked = ref(true);
return {
checked,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
});
return {
...toRefs(state),
};
},
};

View File

@ -155,8 +155,6 @@ export default {
result3: [],
checkAllResult: [],
horizontalResult: [],
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
});
const group = ref();
@ -181,6 +179,8 @@ export default {
setRefs,
checkAll,
toggleAll,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
};
},
};