You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
1.2 KiB

<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.1.36: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 + '&lng=' + options.lng + '&lat=' + options.lat
}
},
onUnload() {
},
methods: {
// webview向外部发送消息
handlePostMessage: function(data) {
console.log("接收到消息:", data.detail);
uni.$emit('mapData',data.detail);
},
}
}
</script>