<template>
	<view>
		<web-view :webview-styles="{height:'100%'}" ref="webview" fullscreen="false" :src="url" @message="handlePostMessage"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// url: 'http://192.168.3.109:89/map.html'
				// url: 'http://171.16.8.51:8080/map.html'
				// url:'http://192.169.9.252:1883/map.html',
				url:'http://171.16.8.53:1883/map.html',
				
			}
		},
		onLoad(options) {
			console.log('options ====>',options)
			if(options.floorNo && options.lat) {
				// this.url = 'http://192.168.3.109:89/map.html?floorNo=' + options.floorNo + '&lat=' + options.lat + '&lng=' + options.lng
				// this.url = 'http://171.16.8.51:8080/map.html?floorNo=' + options.floorNo + '&lat=' + options.lat + '&lng=' + options.lng
				// this.url = 'http://192.169.9.252:1883/map.html?floorNo=' + options.floorNo + '&lat=' + options.lat + '&lng=' + options.lng
				this.url = 'http://171.16.8.53:1883/map.html?floorNo=' + options.floorNo + '&lat=' + options.lat + '&lng=' + options.lng
			}
		},
		onUnload() {
		},
		methods: {
			// webview向外部发送消息
			handlePostMessage: function(data) {
				console.log("接收到消息：", data.detail);
				uni.$emit('mapData',data.detail);
			},
		}
	}
</script>
