提交 | 用户 | 时间
|
820397
|
1 |
<script lang="ts" setup> |
H |
2 |
import { PropType } from 'vue' |
|
3 |
import { propTypes } from '@/utils/propTypes' |
|
4 |
|
|
5 |
defineOptions({ name: 'ImageViewer' }) |
|
6 |
|
|
7 |
const props = defineProps({ |
|
8 |
urlList: { |
|
9 |
type: Array as PropType<string[]>, |
|
10 |
default: (): string[] => [] |
|
11 |
}, |
|
12 |
zIndex: propTypes.number.def(200), |
|
13 |
initialIndex: propTypes.number.def(0), |
|
14 |
infinite: propTypes.bool.def(true), |
|
15 |
hideOnClickModal: propTypes.bool.def(false), |
|
16 |
teleported: propTypes.bool.def(false), |
|
17 |
show: propTypes.bool.def(false) |
|
18 |
}) |
|
19 |
|
|
20 |
const getBindValue = computed(() => { |
|
21 |
const propsData: Recordable = { ...props } |
|
22 |
delete propsData.show |
|
23 |
return propsData |
|
24 |
}) |
|
25 |
|
|
26 |
const show = ref(props.show) |
|
27 |
|
|
28 |
const close = () => { |
|
29 |
show.value = false |
|
30 |
} |
|
31 |
</script> |
|
32 |
|
|
33 |
<template> |
|
34 |
<ElImageViewer v-if="show" v-bind="getBindValue" @close="close" /> |
|
35 |
</template> |