wx-open-launch-app标签可以显示并相应点击,但是点击后跳转了应用宝的APP页而不是直接启动APP,请问如何排查呢?
1.APP已正确接入微信登录,已上架应用宝
2.微信开放平台 -> 管理中心->公众号,已关联APP并绑定JS接口安全域名
(1)JS接口安全域名绑定的是xxx.xxx.com,显示wx-open-launch-app标签的网页地址是 https://xxx.xxx.com/#/
(2)微信开放平台,微信公众平台,都绑定了域名xxx.xxx.com
3.代码里面,wx.ready回调执行了,wx.error回调没有执行,日志中输出了一条“ checkJsApi success ... errMsg:"checkJsApi:ok" ”,是不是说明代码执行成功 且 授权成功(日志中没看到任何错误信息,wx.config配置了debug:true,打开网页后弹了好几个窗,基本都是errMsg: xxx: ok)
4.关键代码如下
wx.config({
debug: true,
appId, //这里是服务号的appId
timestamp,
nonceStr,
signature,
jsApiList: [
// 'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'updateAppMessageShareData',
'updateTimelineShareData'
],
openTagList: ['wx-open-launch-app'] // 这里要配置一下
})
<wx-open-launch-app
ref="launchBtn"
id="launch-btn"
style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"
extinfo=${extinfo}
appid="${appId}"> //这里是要启动的APP的微信appid
<script type="text/wxtag-template">
<div style="
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
z-index:10;
height: ${px2vw(height)}px">
测试测试
</div>
</script>
</wx-open-launch-app>
你好,请问报错提示什么呢?控制台打印下报错和config入参
"config", {"debug": true, "appId": "wx9e0a7196708f97b1", "timestamp": 1748951921297, "nonceStr": "69a2e69fa6e84bb79b77f69e35834e12", "signature": "d1950995c29e3b9ba64226a4c2eecd77a9d6050b", "jsApiList": ["menu:share:timeline", "menu:share:appmessage", "updateAppMessageShareData", "updateTimelineShareData"], "openTagList": ["wx-open-launch-app"]}
error {"isTrusted": false} {"errMsg": "launch:fail", "appId": "wxca8af54013e53505", "extInfo": "{}"}
又发现一个现象,我将测试环境部署好的网页链接发给微信文件助手,通过微信文件助手打开链接后会报上面的错误。使用微信开发者工具打开网页链接,再通过微信扫开发工具“预览”的二维码在手机微信打开链接后,点击按钮就可以正常启动APP
launchBtn.addEventListener('error', function (e: any) {
console.log('zjyy3 error', e, e?.detail)
})