| | |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import Viewer from 'viewerjs' |
| | | import {requestCtx} from '../../assets/js/config' |
| | | import { requestCtx } from '../../assets/js/config' |
| | | import 'viewerjs/dist/viewer.css' |
| | | import { defineProps, inject, onMounted, ref, watch } from 'vue' |
| | | const props = defineProps<{ md5: String; title: String; isClear: Boolean }>() |
| | |
| | | const totalPage = ref<Number>(1) |
| | | const viewerCon = ref<any>(null) |
| | | const preViewMd5 = ref<String>('') |
| | | |
| | | onMounted(() => { |
| | | scrollBottom() |
| | | clearDom() |
| | |
| | | }) |
| | | |
| | | watch( |
| | | props.isClear, |
| | | () => props.isClear, |
| | | (val) => { |
| | | if (val == true) preViewMd5.value = '' |
| | | if (val == true) { |
| | | preViewMd5.value = '' |
| | | totalPage.value = 1 |
| | | viewerCon.value = null |
| | | preViewMd5.value = '' |
| | | currentPageSrc.value='' |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ) |
| | |
| | | MG.file |
| | | .getPdfInfo({ md5: preViewMd5.value }) |
| | | .then((res) => { |
| | | totalPage.value = res.totalPages |
| | | totalPage.value = JSON.parse(res).totalPages |
| | | createDom(currentPage.value) |
| | | }) |
| | | .catch((err) => { |