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

<script>
	import config from "@/config";
	import {
		getBimViewToken
	} from '@/request/api/bim.js'
	export default {
		data() {
			return {
				webViewUrl: null,
				option: {
					type: 'model',
					fileId: 10000898047083,
					showType: '1',
					title: '模型'
				}
			}
		},
		onShow() {
			this.initBadge();
		},
		onLoad(body) {
			this.initModel();
		},
		methods: {
			initModel() {
				getBimViewToken(this.option.fileId).then(res => {
					this.webViewUrl =
						`${config.baseUrl}/webview/bim/preview.html?viewToken=${res.data}&title=${this.option.title}&showType=${this.option.showType}`;
				})
			}
		}
	}
</script>

<style>

</style>