<template>
	<view>
		<web-view v-if="pdfUrl" :src="pdfUrl"></web-view>
	</view>
</template>

<script setup>
	import {ref} from "vue"
	import {onLoad} from "@dcloudio/uni-app"
	
	
	const pdfUrl = ref('');
	const httpUrl = ref('');
	
	function updatePdfUrl(url) {
		httpUrl.value = url;
		pdfUrl.value = '/hybrid/html/web/viewer.html?file=' + encodeURIComponent(url);
	}
	
	
	onLoad(({url}) => {
		const mockUrl = "https://501351981.github.io/vue-office/examples/dist/static/test-files/test.pdf"
		updatePdfUrl(url||mockUrl);
	})
	
</script>

<style>

</style>
