<template>
	<view>
		<web-view :webview-styles="{
			progress:false
		}" v-if="webviewUrl" :src="webviewUrl" @message="message"></web-view>
	</view>
</template>

<script>
	import config from '@/config';
	export default {
		data() {
			return {
				webviewUrl: ''
			}
		},
		onShow() {
			// this.initUrl();
		},
		onLoad(body) {
			this.params = body;
			this.initUrl();
		},
		methods: {
			initUrl() {
				if (!this.params.url) return;
				let path = decodeURIComponent(this.params.url);
				let link = path.indexOf('?') === -1 ? '?' : '&';
				this.webviewUrl = config.webviewUrl + path + link + 'token=' + uni.getStorageSync('shopMobileToken') +
					'&time=' + new Date().getTime();
			},
			message(e) {
				console.log(e.detail);
			}
		}
	}
</script>

<style>

</style>