<template>
	<div>
		 <LoadingD :status="loading"></LoadingD>
		<vue-pdf-app style="height: 100vh; width: 100vw" :pdf="pdfData"></vue-pdf-app>
	</div>
</template>

<script setup>
	import {
		ref,
		reactive,
		nextTick,
		onMounted
	} from 'vue';
	import {
		GetPersonPdfDetailByLink
	} from "@/api/api.js";
	import {
		useRoute,
		useRouter
	} from "vue-router"
	import {
		showToast,
		showDialog
	} from 'vant';
	// pdf
	import VuePdfApp from "vue3-pdf-app";
	import "vue3-pdf-app/dist/icons/main.css";

	const route = useRoute()
	const router = useRouter()
	let loading = ref(false);
	let pdf_num = route.query.pdf_num //获取到pdf array的key
	let recordid = route.query.recordid
	let biao = route.query.biao


	let pdfData = ref(null);

	 

	const getPdf = () => {
		loading.value = true
		GetPersonPdfDetailByLink({
			recordid: recordid,
			pdf_num: pdf_num,
			biao:biao
		}).then(res => {
			loading.value = false

			console.log(res)

			// const blob = new Blob([res], { type: 'application/pdf;charset=UTF-8' }); // 根据实际图片类型调整
			//     const imageUrl =  URL.createObjectURL(blob);

			// 	 pdfData.value=imageUrl
			const binaryData = []
			binaryData.push(res) //res就是pdf流文件
			//获取blob链接
			pdfData.value = window.URL.createObjectURL(new Blob(binaryData, {
				type: 'application/pdf'
			}))




		})
	}

	onMounted(() => {
		getPdf()
		//  window.location.href=tijian_file



	})
</script>

<style>
</style>