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.
49 lines
1.2 KiB
49 lines
1.2 KiB
<template>
|
|
<web-view :src="src" @message="handleMessage" />
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex';
|
|
|
|
export default {
|
|
data() {
|
|
return { src: '' };
|
|
},
|
|
|
|
computed: mapGetters('user', ['userId']),
|
|
|
|
onLoad(options) {
|
|
const obj = { title: '暴风眼Typhoneye', path: '/pages/index/index' };
|
|
uni.showShareMenu(obj);
|
|
if (!options) {
|
|
this.$t.ui.showModal('缺少参数, 请返回重试');
|
|
} else {
|
|
const { jumpUrl } = options;
|
|
let url = jumpUrl + '?';
|
|
for (let key in options) {
|
|
if (key !== 'jumpUrl') {
|
|
url += `${key}=${options[key]}&`;
|
|
}
|
|
}
|
|
this.src = url;
|
|
console.log('url: ', url);
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
onShareAppMessage() {
|
|
return { title: '暴风眼Typhoneye', path: '/pages/index/index' };
|
|
},
|
|
|
|
// webview向外部发送消息
|
|
handleMessage(evt) {
|
|
console.log('接收到的消息-evt: ', evt);
|
|
console.log('接收到的消息:' + JSON.stringify(evt.detail.data));
|
|
if (evt.detail.data[0].action === 'back') {
|
|
uni.navigateBack();
|
|
uni.reLaunch({ url: `/pages/index/index?u=${this.userId}` });
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|