docs: remove toRefs

This commit is contained in:
chenjiahan
2020-12-10 20:55:28 +08:00
parent 3e7e19935a
commit e785f622bd
4 changed files with 44 additions and 44 deletions
+7 -3
View File
@@ -82,13 +82,17 @@ setTimeout(() => {
### Component Call
```html
<van-image-preview v-model:show="show" :images="images" @change="onChange">
<van-image-preview
v-model:show="state.show"
:images="state.images"
@change="onChange"
>
<template v-slot:index>Page: {{ index }}</template>
</van-image-preview>
```
```js
import { reactive, toRefs } from 'vue';
import { reactive } from 'vue';
export default {
setup() {
@@ -101,7 +105,7 @@ export default {
};
return {
...toRefs(state),
state,
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
+7 -3
View File
@@ -117,13 +117,17 @@ setTimeout(() => {
如果需要在图片预览内嵌入组件或其他自定义内容,可以使用组件调用的方式,调用前需要通过 `app.use` 注册组件。
```html
<van-image-preview v-model:show="show" :images="images" @change="onChange">
<van-image-preview
v-model:show="state.show"
:images="state.images"
@change="onChange"
>
<template v-slot:index>第{{ index }}页</template>
</van-image-preview>
```
```js
import { reactive, toRefs } from 'vue';
import { reactive } from 'vue';
export default {
setup() {
@@ -136,7 +140,7 @@ export default {
};
return {
...toRefs(state),
state,
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',