fix(image-preview):fix image-preview README、supplement teleport (#11429)

Co-authored-by: xuwenqiang <xuwenqiang@kanzhun.com>
This commit is contained in:
MrXwq 2022-12-28 18:23:28 +08:00 committed by GitHub
parent 9b00eb271c
commit 53ec8a91a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import {
type PropType, type PropType,
type CSSProperties, type CSSProperties,
type ExtractPropTypes, type ExtractPropTypes,
type TeleportProps,
} from 'vue'; } from 'vue';
// Utils // Utils
@ -46,6 +47,7 @@ const popupProps = [
'transition', 'transition',
'overlayStyle', 'overlayStyle',
'closeOnPopstate', 'closeOnPopstate',
'teleport'
] as const; ] as const;
export const imagePreviewProps = { export const imagePreviewProps = {
@ -68,6 +70,7 @@ export const imagePreviewProps = {
showIndicators: Boolean, showIndicators: Boolean,
closeOnPopstate: truthProp, closeOnPopstate: truthProp,
closeIconPosition: makeStringProp<PopupCloseIconPosition>('top-right'), closeIconPosition: makeStringProp<PopupCloseIconPosition>('top-right'),
teleport: [String, Object] as PropType<TeleportProps['to']>,
}; };
export type ImagePreviewProps = ExtractPropTypes<typeof imagePreviewProps>; export type ImagePreviewProps = ExtractPropTypes<typeof imagePreviewProps>;

View File

@ -109,7 +109,7 @@ setTimeout(() => {
```html ```html
<van-image-preview v-model:show="show" :images="images" @change="onChange"> <van-image-preview v-model:show="show" :images="images" @change="onChange">
<template v-slot:index>Page: {{ index }}</template> <template v-slot:index>Page: {{ index + 1 }}</template>
</van-image-preview> </van-image-preview>
``` ```

View File

@ -120,7 +120,7 @@ setTimeout(() => {
```html ```html
<van-image-preview v-model:show="show" :images="images" @change="onChange"> <van-image-preview v-model:show="show" :images="images" @change="onChange">
<template v-slot:index>第{{ index }}页</template> <template v-slot:index>第{{ index + 1 }}页</template>
</van-image-preview> </van-image-preview>
``` ```