<template>
|
<div class="notice">
|
<el-dialog
|
v-model="dialogVisible"
|
width="50%"
|
title="文件预览"
|
:before-close="handleClose"
|
:close-on-press-escape="false"
|
:close-on-click-modal="false"
|
>
|
<div style="width: 100%;height: auto;">
|
<iframe
|
:src="state.iframeSrc"
|
width="100%"
|
height="750px"
|
class="custom-iframe"
|
></iframe>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
<script setup>
|
import {reactive, ref, toRefs} from 'vue'
|
const dialogVisible = ref(false);
|
const title = ref("");
|
|
const emit = defineEmits(["getList"]);
|
|
const state = reactive({
|
iframeSrc: ''
|
})
|
|
|
const openDialog = async (value) => {
|
state.iframeSrc = import.meta.env.VITE_APP_BASE_API + value.itemFile
|
dialogVisible.value = true;
|
}
|
|
const handleClose = () => {
|
reset();
|
dialogVisible.value = false;
|
emit("getList")
|
}
|
const reset = () => {
|
state.iframeSrc = ''
|
}
|
|
defineExpose({
|
openDialog
|
});
|
|
</script>
|
|
<style scoped lang="scss">
|
.notice{
|
.custom-iframe {
|
border: 1px solid #9b9999;
|
/* 隐藏原生滚动条 */
|
overflow: hidden;
|
}
|
}
|
</style>
|