123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <view>
- <web-view :src="href"></web-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- href: "",
- };
- },
- onLoad() {
- // #ifndef APP-NVUE
- const eventChannel = this.getOpenerEventChannel();
- // #endif
- // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
- eventChannel.on('acceptDataFromOpenerPage', (data) => {
- console.log(data.data)
- let link = data.data.link
- let token = uni.getStorageSync('ningmei_token')
- let appid = data.data.app_id
- this.href = link + '?timestamp=' + Date.now() + '&token=' + token + '&appid=' + appid
- })
- },
- onReady() {
- setTimeout(()=>{
- this.clearMuiBack()
- },3000)
- },
- methods: {
- // 关闭mui返回
- clearMuiBack() {
- // #ifdef APP-PLUS
- let currentWebview = this.$scope.$getAppWebview().children()[0]
- //监听注入的js
- currentWebview.addEventListener("loaded", function() {
- currentWebview.evalJS("mui.init({keyEventBind: {backbutton: false }});");
- });
- // #endif
- },
- },
- }
- </script>
- <style lang="scss">
- </style>
|