wx-open-subscribe开放标签按钮线上环境不显示?
发布于 6 年前 作者 weiding 12636 次浏览 来自 问答

语言是vue.js

控制台打印出来的

按钮代码

<wx-open-subscribe style="width: 15rem;height: 4.5rem;" @success="success" @error="subError" :template="subTemplateId" id="subscribe-btn" >
    <script type="text/wxtag-template">
    <style>
        .btn2 {
            display: flex;
            align-items: flex-end;
            font-size: 2.5rem;
            font-weight: 600;
            color: rgb(21, 116, 70);
            width: 13rem;
            border: unset;
            background: unset;
            margin: 0;
            padding: 0;
            cursor: pointer;
        }
    </style>
    <button class="btn2"><img style="width: 3.3rem; height: 3.3rem; margin-right: 1rem;" src="../../../new-osc/page/open-source-daily/img/option/like.png">订阅</button>
    </script>
</wx-open-subscribe>

js代码

created(){
    // 微信接口参数
    var appId = page.wxSubscribeAppId;
    var timestamp = page.wxSubscribeTimestamp;
    var nonceStr = page.wxSubscribeNonceStr;
    var signature = page.wxSubscribeSignature;
    console.log(1133,appId,timestamp,nonceStr,signature)
    if (!(appId && timestamp && nonceStr && signature)) {
        return false;
    }
    console.log('[WECHAT JSSDK] wxSubscribe config start');
    // 配置微信SDK
    wx.config({
        debug: true,
        appId: appId,
        timestamp: timestamp,
        nonceStr: nonceStr,
        signature: signature,
        jsApiList: ['updateTimelineShareData', 'updateAppMessageShareData'],
        openTagList: ['wx-open-subscribe']
    });
    wx.ready(function () {
        console.log('[WECHAT JSSDK] wxSubscribe config ready');
        wx.checkJsApi({
            jsApiList: ['updateTimelineShareData','wx-open-subscribe'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
            openTagList: ['wx-open-subscribe'],
            success: function(res) {
                console.log('微信 wxSubscribe check',res)
                // 以键值对的形式返回,可用的api值true,不可用为false
                // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
            }
        });
    });
},
1 回复

你好,1、请注意更新到最新版的开发者工具,下载地址:https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html

2、请确认 wx.config 里有申请开放标签的权限,参考文档:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html

3、如仍未调试成功,请提供具体的appid、代码、报错信息和截图。

回到顶部