qa-regulatory-gwj-app/pages/map/map.vue

49 lines
1.1 KiB
Vue
Raw Normal View History

2023-11-07 10:08:37 +08:00
<template>
<view>
<web-view id="webview" :src="url" @message="messageChange"></web-view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
url: '',
}
},
onLoad(option) {
let _this = this;
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
// 监听acceptDataFromOpenerPage事件获取上一页面通过eventChannel传送到当前页面的数据
eventChannel.on('acceptDataFromOpenerPage', function (data) {
_this.init(data.data.title);
})
},
onBackPress(options) {
return false;
},
methods: {
init(title) {
this.url = ("/hybrid/html/jsmap.html?t=" + new Date().getTime() + '&title=' + title);
},
messageChange(e) {
uni.setStorageSync("info", e.detail.data[0]);
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
eventChannel.emit('acceptDataFromOpenedPage', {data: e.detail.data[0]});
uni.navigateBack();
}
}
}
</script>
<style scoped>
page,
uni-page-body,
.container {
background: rgba(245, 245, 245, 1);
min-height: calc(100%);
}
</style>