闫增涛
2024-11-05 58e3b80c2d26b831900759bf8666c7fd9c759df5
src/views/components/pdfview.vue
@@ -23,7 +23,7 @@
</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 }>()
@@ -33,6 +33,7 @@
const totalPage = ref<Number>(1)
const viewerCon = ref<any>(null)
const preViewMd5 = ref<String>('')
onMounted(() => {
  scrollBottom()
  clearDom()
@@ -40,9 +41,15 @@
})
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 }
)
@@ -124,7 +131,7 @@
  MG.file
    .getPdfInfo({ md5: preViewMd5.value })
    .then((res) => {
      totalPage.value = res.totalPages
      totalPage.value = JSON.parse(res).totalPages
      createDom(currentPage.value)
    })
    .catch((err) => {