diff --git a/src/card/test/__snapshots__/demo.spec.js.snap b/src/card/test/__snapshots__/demo.spec.js.snap
index 567d0486e..73bed95eb 100644
--- a/src/card/test/__snapshots__/demo.spec.js.snap
+++ b/src/card/test/__snapshots__/demo.spec.js.snap
@@ -137,12 +137,12 @@ exports[`should render demo and match snapshot 1`] = `
- 标签
+ Tag
- 标签
+ Tag
diff --git a/src/sidebar/README.md b/src/sidebar/README.md
index 76516bc36..c176b1a3f 100644
--- a/src/sidebar/README.md
+++ b/src/sidebar/README.md
@@ -16,7 +16,7 @@ app.use(SidebarItem);
### Basic Usage
```html
-
+
@@ -24,11 +24,12 @@ app.use(SidebarItem);
```
```js
+import { ref } from 'vue';
+
export default {
- data() {
- return {
- activeKey: 0,
- };
+ setup() {
+ const active = ref(0);
+ return { active };
},
};
```
@@ -36,17 +37,17 @@ export default {
### Show Badge
```html
-
+
-
+
```
### Disabled
```html
-
+
@@ -56,26 +57,28 @@ export default {
### Change Event
```html
-
-
-
-
+
+
+
+
```
```js
-import { Notify } from 'vant';
+import { ref } from 'vue';
+import { Toast } from 'vant';
export default {
- data() {
+ setup() {
+ const active = ref(0);
+ const onChange = (index) => {
+ Toast(`Title ${index + 1}`);
+ };
+
return {
- activeKey: 0,
+ active,
+ onChange,
};
- },
- methods: {
- onChange(index) {
- Notify({ type: 'primary', message: index });
- },
},
};
```
diff --git a/src/sidebar/README.zh-CN.md b/src/sidebar/README.zh-CN.md
index f27e1ea0e..cedc07b1e 100644
--- a/src/sidebar/README.zh-CN.md
+++ b/src/sidebar/README.zh-CN.md
@@ -18,7 +18,7 @@ app.use(SidebarItem);
通过 `v-model` 绑定当前选中项的索引。
```html
-
+
@@ -26,11 +26,12 @@ app.use(SidebarItem);
```
```js
+import { ref } from 'vue';
+
export default {
- data() {
- return {
- activeKey: 0,
- };
+ setup() {
+ const active = ref(0);
+ return { active };
},
};
```
@@ -40,10 +41,10 @@ export default {
设置 `dot` 属性后,会在右上角展示一个小红点;设置 `badge` 属性后,会在右上角展示相应的徽标。
```html
-
+
-
+
```
@@ -52,7 +53,7 @@ export default {
通过 `disabled` 属性禁用选项。
```html
-
+
@@ -64,26 +65,28 @@ export default {
设置 `change` 方法来监听切换导航项时的事件。
```html
-
-
-
-
+
+
+
+
```
```js
-import { Notify } from 'vant';
+import { ref } from 'vue';
+import { Toast } from 'vant';
export default {
- data() {
+ setup() {
+ const active = ref(0);
+ const onChange = (index) => {
+ Toast(`标签名 ${index + 1}`);
+ };
+
return {
- activeKey: 0,
+ active,
+ onChange,
};
- },
- methods: {
- onChange(index) {
- Notify({ type: 'primary', message: index });
- },
},
};
```
diff --git a/src/sidebar/demo/index.vue b/src/sidebar/demo/index.vue
index c82b67f14..4bd42b640 100644
--- a/src/sidebar/demo/index.vue
+++ b/src/sidebar/demo/index.vue
@@ -2,7 +2,7 @@
-
+
@@ -11,16 +11,16 @@
-
+
-
+
-
+
@@ -29,49 +29,53 @@
-
-
-
-
+
+
+
+
-
diff --git a/src/sidebar/test/__snapshots__/demo.spec.js.snap b/src/sidebar/test/__snapshots__/demo.spec.js.snap
index d7a1e809b..6f3baf230 100644
--- a/src/sidebar/test/__snapshots__/demo.spec.js.snap
+++ b/src/sidebar/test/__snapshots__/demo.spec.js.snap
@@ -55,7 +55,7 @@ exports[`should render demo and match snapshot 1`] = `
@@ -98,17 +98,17 @@ exports[`should render demo and match snapshot 1`] = `