<template>
	<view class="pdf-container" v-if="pdfUrl" >
		<template v-if="systemInfo.platform !== 'android'">
			<web-view
				:src="pdfUrl1"
				class="web-view"></web-view>
		</template>
		<template v-else>
			<web-view :src="pdfUrl" class="web-view"></web-view>
		</template>
	</view>
</template>

<script setup>
	const props = defineProps({
		pdfUrl: {
			type: String
		}
	})
	const systemInfo = uni.getSystemInfoSync();
	
	const pdfUrl1 = `/hybrid/html/web/viewer.html?file=${encodeURIComponent(props.pdfUrl)}`
</script>

<style lang="scss">
	.pdf-container {
		width: 100%;
		height: 200px; // 固定高度
		position: relative;
		overflow: hidden;
		border: 1px solid #eee;
		margin-top: 20px;
	}
</style>