mirror of
https://github.com/youzan/vant.git
synced 2026-01-21 01:15:55 +08:00
docs: prefer using ref (#9285)
* docs: prefer using ref * docs: fix lint error
This commit is contained in:
@@ -22,21 +22,19 @@ app.use(TreeSelect);
|
||||
|
||||
```html
|
||||
<van-tree-select
|
||||
v-model:active-id="state.activeId"
|
||||
v-model:main-active-index="state.activeIndex"
|
||||
v-model:active-id="activeId"
|
||||
v-model:main-active-index="activeIndex"
|
||||
:items="items"
|
||||
/>
|
||||
```
|
||||
|
||||
```js
|
||||
import { reactive } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeId: 1,
|
||||
activeIndex: 0,
|
||||
});
|
||||
const activeId = ref(1);
|
||||
const activeIndex = ref(0);
|
||||
const items = [
|
||||
{
|
||||
text: 'Group 1',
|
||||
@@ -55,8 +53,9 @@ export default {
|
||||
];
|
||||
|
||||
return {
|
||||
state,
|
||||
items,
|
||||
activeId,
|
||||
activeIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -66,21 +65,19 @@ export default {
|
||||
|
||||
```html
|
||||
<van-tree-select
|
||||
v-model:active-id="state.activeIds"
|
||||
v-model:main-active-index="state.activeIndex"
|
||||
v-model:active-id="activeIds"
|
||||
v-model:main-active-index="activeIndex"
|
||||
:items="items"
|
||||
/>
|
||||
```
|
||||
|
||||
```js
|
||||
import { reactive } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeId: [1, 2],
|
||||
activeIndex: 0,
|
||||
});
|
||||
const activeId = ref([1, 2]);
|
||||
const activeIndex = ref(0);
|
||||
const items = [
|
||||
{
|
||||
text: 'Group 1',
|
||||
@@ -99,8 +96,9 @@ export default {
|
||||
];
|
||||
|
||||
return {
|
||||
state,
|
||||
items,
|
||||
activeId,
|
||||
activeIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -24,21 +24,19 @@ app.use(TreeSelect);
|
||||
|
||||
```html
|
||||
<van-tree-select
|
||||
v-model:active-id="state.activeId"
|
||||
v-model:main-active-index="state.activeIndex"
|
||||
v-model:active-id="activeId"
|
||||
v-model:main-active-index="activeIndex"
|
||||
:items="items"
|
||||
/>
|
||||
```
|
||||
|
||||
```js
|
||||
import { reactive } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeId: 1,
|
||||
activeIndex: 0,
|
||||
});
|
||||
const activeId = ref(1);
|
||||
const activeIndex = ref(0);
|
||||
const items = [
|
||||
{
|
||||
text: '浙江',
|
||||
@@ -57,8 +55,9 @@ export default {
|
||||
];
|
||||
|
||||
return {
|
||||
state,
|
||||
items,
|
||||
activeId,
|
||||
activeIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -70,21 +69,19 @@ export default {
|
||||
|
||||
```html
|
||||
<van-tree-select
|
||||
v-model:active-id="state.activeIds"
|
||||
v-model:main-active-index="state.activeIndex"
|
||||
v-model:active-id="activeIds"
|
||||
v-model:main-active-index="activeIndex"
|
||||
:items="items"
|
||||
/>
|
||||
```
|
||||
|
||||
```js
|
||||
import { reactive } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const state = reactive({
|
||||
activeId: [1, 2],
|
||||
activeIndex: 0,
|
||||
});
|
||||
const activeId = ref([1, 2]);
|
||||
const activeIndex = ref(0);
|
||||
const items = [
|
||||
{
|
||||
text: '浙江',
|
||||
@@ -103,8 +100,9 @@ export default {
|
||||
];
|
||||
|
||||
return {
|
||||
state,
|
||||
items,
|
||||
activeId,
|
||||
activeIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user