<template>
    <el-dialog v-model="value" title="预览pdf" width="90%">
        <iframe :src="previewSrc" frameborder="0" width="100%" :height="iframeHeight + 'px'" />
    </el-dialog>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue'
import { useToggle } from '@vueuse/core'

const [value, toggle] = useToggle()

const previewSrc = ref('')
const openDialog = (src: string) => {
    toggle(true)
    previewSrc.value = src
}

const iframeHeight = computed(() => {
    return window.innerHeight - 180
})

defineExpose({
    openDialog
})
</script>
<style scoped></style>
