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

<script>
	import {
		getBimViewToken
	} from '@/request/api/bim.js'
	export default {
		data() {
			return {
				webViewUrl: null,
				option: {}
			}
		},
		onLoad(body) {
			this.option = body;
			if (body.type == 'model') this.initModel();
		},
		methods: {
			initModel() {
				getBimViewToken(this.option.fileId).then(res => {
					this.webViewUrl =
						`http://192.168.101.6:8848/webview/bim/preview.html?viewToken=${res.data}&title=${this.option.title}&showType=${this.option.showType}`;
				})
			}
		}
	}
</script>

<style>

</style>