当前位置: 首页 > 工具软件 > AppLaunch > 使用案例 >

H5启动app,wx-open-launch-app,提示launch:fail_check fail

谭修然
2023-12-01

在进行js安全域名配置时,不要仅写顶级域名,写除http://或者https://以外的完整域名

wx.config({
                    debug: false, 
                    appId: data.data.appid, 
                    timestamp: data.data.timestamp, 
                    nonceStr: data.data.noncestr, 
                    signature: data.data.signature,
                    jsApiList: [],
                    openTagList: [
                        'wx-open-launch-app',
                        'wx-open-launch-weapp'
                    ] 
                })
                wx.ready(function () {
                })
                wx.error(function(res) {
                    console.log(res)
                })

                var btn = document.getElementById('launch-btn');
                btn.addEventListener('ready', function (e) {
                    console.log(e)
                });
                btn.addEventListener('launch', function (e) {
                    alert('success');
                });
                btn.addEventListener('error', function (e) {
                    alert(e.detail)
                    console.log('fail', e.detail)
                });
                btn.addEventListener('WeixinOpenTagsError', function (e) {
                    console.error(e.detail.errMsg)
                })
<wx-open-launch-app
        id="launch-btn"
        appid="关联的app的id"
        extinfo=""
    >
    <script type="text/wxtag-template">
        <style>.btn { padding: 12px }</style>
        <button class="btn">App内查看</button>
    </script>
    </wx-open-launch-app>
 类似资料: