
<template>
  <view>
    <web-view :src="webUrl" @message="getMessage" id="myWebView"></web-view>
  </view>
</template>
 
<script>
export default {
	data() {
		return {
			webUrl:"http://192.168.2.91:8081/#/pages/stage/index?toekn="+uni.getStorageSync('App-Token')+"&mobile="+uni.getStorageSync('mobile')
		}
	},
	onLoad() {
		window.addEventListener("message", this.getMessage); 
	},
	methods: {
		getMessage(event) {  //在H5端使用通信返回App端
			console.log(event, '0000000000000000000000000')
			if (event.data.data.arg.action == 'stage_navigateBack') {
				uni.reLaunch({
					url: '/pages/system'
				});
			}
			if (event.data.data.arg.action == 'logOut') {
				uni.reLaunch({
					url: '/pages/login'
				});
			}
		}
	}
}
</script>