<wx-open-launch-weapp>点击无反应?
发布于 5 年前 作者 juanchang 5731 次浏览 来自 问答

微信公众号的测试号内的网页进行调用小程序,点击什么反应都没有。公众号关联了小程序,js安全域名也配置了,小程序没有正式发布,wx.config是正常,不知道怎么回事

代码片段

   
 <wx-open-launch-weapp id="launch-btn" @launch="handleLaunchFn" @error="handleErrorFn"
            username="gh_xxxxxxx" path="/pages/xxx/index.html">
                <template>
                    <button>打开小程序</button>
                </template>
            </wx-open-launch-weapp>

handleLaunchFn (e) {
            alert(e)
        },
        handleErrorFn(e){
            alert('fail', e.detail);
        },
        initWx () {
            wxConfig({url: location.href.split('#')[0]}).success(data => {
                wx.config({
                    debugfalse,
                    appId: data.appId,
                    timestamp: data.timestamp,
                    nonceStr: data.nonceStr,
                    signature: data.signature,
                    jsApiList: [
                        'checkJsApi',
                        'onMenuShareAppMessage',
                        'onMenuShareQQ'
                    ],
                    openTagList: ['wx-open-launch-weapp']
                });
                wx.ready(() => {
                    let btn = document.getElementById('launch-btn');
                    btn.addEventListener('launch'function (e{
                    });
                    btn.addEventListener('error'function (e{
                        console.log('fail', e.detail);
                    });
                });
                wx.error(function (res{
                    console.log(res)
                });
            });
        }
回到顶部