-
@@ -12,12 +21,23 @@ import { patientAPI, detectionAPI,historyAPI,getBackendUrl } from '@/services/ap
import { ref, onMounted } from 'vue'
import * as pdfjsLib from 'pdfjs-dist'
+const emit = defineEmits([ 'closeViewPDF' ]);
+const props = defineProps({
+ pdfUrl: {
+ required: false,
+ type: String,
+ default: ''
+ }
+})
+const pdfUrl = ref(props.pdfUrl)
const pdfContainer = ref(null) // 容器用于挂载多个 canvas
// 设置 worker 路径(重要)
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.js'
const BACKEND_URL = getBackendUrl()
const pdfCanvas = ref(null)
-
+ function handleCancel(){
+ emit('closeViewPDF',false)
+ }
// const renderPDF = async (url) => {
// try {
// // 加载 PDF 文档
@@ -106,7 +126,7 @@ const renderPage = async (pdf, pageNum, scale) => {
}
onMounted(() => {
// 替换为你的 PDF 文件路径或 URL
- renderPDF(`${BACKEND_URL}/202512070001/20251209141628/report_142802459.pdf`) // 可以是本地文件或远程链接
+ // renderPDF(`${BACKEND_URL}/202512070001/20251209141628/report_142802459.pdf`) // 可以是本地文件或远程链接
})
@@ -139,4 +159,12 @@ canvas {
border-radius: 8px;
overflow: auto;
}
+
+.viewPDF-header{
+ height: 60px;
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ padding-right: 20px;
+}
\ No newline at end of file