mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2026-02-23 21:30:26 +00:00
36 lines
584 B
Vue
36 lines
584 B
Vue
<template>
|
|
<div class="item-viewer">
|
|
<el-image-viewer
|
|
v-if="visible"
|
|
:url-list="urls"
|
|
:initial-index="index"
|
|
infinite
|
|
teleported
|
|
@close="close"
|
|
></el-image-viewer>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup name="item-viewer">
|
|
import { ref } from "vue";
|
|
|
|
const visible = ref(false);
|
|
const urls = ref<string[]>([]);
|
|
const index = ref(0);
|
|
|
|
function open(url: string, list: string[]) {
|
|
visible.value = true;
|
|
|
|
urls.value = list;
|
|
index.value = list.findIndex((e) => e == url);
|
|
}
|
|
|
|
function close() {
|
|
visible.value = false;
|
|
}
|
|
|
|
defineExpose({
|
|
open
|
|
});
|
|
</script>
|