牛油果
牛油果
  • 发布:2019-04-30 14:24
  • 更新:2020-06-20 14:13
  • 阅读:3019

uniapp 打开webview模式下的天猫国际,天猫等,如何有效禁止自动唤醒淘宝app

分类:uni-app

在打开自己app的webview 下的 天猫,淘宝app总是通过js自动唤醒

2019-04-30 14:24 负责人:无 分享
已邀请:
zhuan888

zhuan888

<template>
<view>

</view>  

</template>
<script>
var wv;//计划创建的webview
export default {
data() {
return {
};
},
onLoad() {
// #ifdef APP-PLUS
wv = plus.webview.create("","custom-webview",{
plusrequire:"none",
'uni-app': 'none',
top:uni.getSystemInfoSync().statusBarHeight+44
})
wv.loadURL("https://s.click.taobao.com/VP3zCxv")
var currentWebview = this.$mp.page.$getAppWebview()
currentWebview.append(wv);
wv.overrideUrlLoading({mode:'reject',match:'tbopen://.*'}, function(e){
console.log('reject url: '+e.url);
});
setTimeout(function() {
//console.log(wv.getStyle())
//wv.evalJS('alert("测试弹窗");');

        }, 1000);  
        // #endif  
    }  
};  
</script>
  • chess99

    能不能整理下格式

    2020-06-20 13:56

chess99

chess99

楼上的内容, 加上代码块格式

var wv // 计划创建的webview  
  export default {  
    data () {  
      return {}  
    },  

    onLoad () {  
      // #ifdef APP-PLUS  
      wv = plus.webview.create('', 'custom-webview', {  
        plusrequire: 'none',  
        'uni-app': 'none',  
        top: uni.getSystemInfoSync().statusBarHeight + 44,  
      })  
      wv.loadURL('https://s.click.taobao.com/VP3zCxv')  
      var currentWebview = this.$mp.page.$getAppWebview()  
      currentWebview.append(wv)  
      wv.overrideUrlLoading({ mode: 'reject', match: 'tbopen://.*' }, function (e) {  
        console.log('reject url: ' + e.url)  
      })  
      setTimeout(function () {  
        console.log(wv.getStyle())  
        wv.evalJS('alert("测试弹窗");')  
      }, 1000)  
      // #endif  
    },  
  }

该问题目前已经被锁定, 无法添加新回复