diff --git a/src/tree-select/README.md b/src/tree-select/README.md
index 861e2bc87..3b9e3ca22 100644
--- a/src/tree-select/README.md
+++ b/src/tree-select/README.md
@@ -16,19 +16,41 @@ app.use(TreeSelect);
```html
```
```js
+import { reactive } from 'vue';
+
export default {
- data() {
- return {
- items,
+ setup() {
+ const state = reactive({
activeId: 1,
activeIndex: 0,
+ });
+ const items = [
+ {
+ text: 'Group 1',
+ children: [
+ { text: 'Delaware', id: 1 },
+ { text: 'Florida', id: 2 },
+ ],
+ },
+ {
+ text: 'Group 2',
+ children: [
+ { text: 'Alabama', id: 5 },
+ { text: 'Kansas', id: 6 },
+ ],
+ },
+ ];
+
+ return {
+ state,
+ items,
};
},
};
@@ -38,19 +60,41 @@ export default {
```html
```
```js
+import { reactive } from 'vue';
+
export default {
- data() {
- return {
- items,
- activeIds: [1, 2],
+ setup() {
+ const state = reactive({
+ activeId: [1, 2],
activeIndex: 0,
+ });
+ const items = [
+ {
+ text: 'Group 1',
+ children: [
+ { text: 'Delaware', id: 1 },
+ { text: 'Florida', id: 2 },
+ ],
+ },
+ {
+ text: 'Group 2',
+ children: [
+ { text: 'Alabama', id: 5 },
+ { text: 'Kansas', id: 6 },
+ ],
+ },
+ ];
+
+ return {
+ state,
+ items,
};
},
};
@@ -60,17 +104,17 @@ export default {
```html
@@ -78,10 +122,13 @@ export default {
```
```js
+import { ref } from 'vue';
+
export default {
- data() {
+ setup() {
+ const activeIndex = ref(0);
return {
- active: 0,
+ activeIndex,
items: [{ text: 'Group 1' }, { text: 'Group 2' }],
};
},
@@ -99,10 +146,13 @@ export default {
```
```js
+import { ref } from 'vue';
+
export default {
data() {
+ const activeIndex = ref(0);
return {
- activeIndex: 0,
+ activeIndex,
items: [
{ text: 'Group 1', children: [], dot: true },
{ text: 'Group 2', children: [], badge: 5 },
diff --git a/src/tree-select/README.zh-CN.md b/src/tree-select/README.zh-CN.md
index 3fe1d5598..cc9dd07f3 100644
--- a/src/tree-select/README.zh-CN.md
+++ b/src/tree-select/README.zh-CN.md
@@ -18,19 +18,41 @@ app.use(TreeSelect);
```html
```
```js
+import { reactive } from 'vue';
+
export default {
- data() {
- return {
- items,
+ setup() {
+ const state = reactive({
activeId: 1,
activeIndex: 0,
+ });
+ const items = [
+ {
+ text: '浙江',
+ children: [
+ { text: '杭州', id: 1 },
+ { text: '温州', id: 2 },
+ ],
+ },
+ {
+ text: '江苏',
+ children: [
+ { text: '南京', id: 5 },
+ { text: '无锡', id: 6 },
+ ],
+ },
+ ];
+
+ return {
+ state,
+ items,
};
},
};
@@ -42,19 +64,41 @@ export default {
```html
```
```js
+import { reactive } from 'vue';
+
export default {
- data() {
- return {
- items,
- activeIds: [1, 2],
+ setup() {
+ const state = reactive({
+ activeId: [1, 2],
activeIndex: 0,
+ });
+ const items = [
+ {
+ text: '浙江',
+ children: [
+ { text: '杭州', id: 1 },
+ { text: '温州', id: 2 },
+ ],
+ },
+ {
+ text: '江苏',
+ children: [
+ { text: '南京', id: 5 },
+ { text: '无锡', id: 6 },
+ ],
+ },
+ ];
+
+ return {
+ state,
+ items,
};
},
};
@@ -66,17 +110,17 @@ export default {
```html
@@ -84,10 +128,13 @@ export default {
```
```js
+import { ref } from 'vue';
+
export default {
- data() {
+ setup() {
+ const activeIndex = ref(0);
return {
- active: 0,
+ activeIndex,
items: [{ text: '分组 1' }, { text: '分组 2' }],
};
},
@@ -107,10 +154,13 @@ export default {
```
```js
+import { ref } from 'vue';
+
export default {
data() {
+ const activeIndex = ref(0);
return {
- activeIndex: 0,
+ activeIndex,
items: [
{ text: '浙江', children: [], dot: true },
{ text: '江苏', children: [], badge: 5 },
diff --git a/src/tree-select/demo/index.vue b/src/tree-select/demo/index.vue
index df299cf70..52c82ebee 100644
--- a/src/tree-select/demo/index.vue
+++ b/src/tree-select/demo/index.vue
@@ -46,33 +46,36 @@
-