在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ 微信js-sdk掃一掃,在單應(yīng)用里面還沒有掃描二維碼就自動(dòng)執(zhí)行掃描的回調(diào)了

微信js-sdk掃一掃,在單應(yīng)用里面還沒有掃描二維碼就自動(dòng)執(zhí)行掃描的回調(diào)了

需求:點(diǎn)擊分享按鈕,彈出需要掃描進(jìn)行分享的二維碼,調(diào)用微信js-sdk里面的二維碼掃描功能。

代碼:

<a  class="bottom-send-btn bottom-btn-preview"  id="bottom-send-btn" @click="sendArticle">
            分享
        </a>
        
        
  sendArticle(){
            this.isShowQRCode = true;
            const _this = this;
            const target_url = `http://192.168.0.102:8787/#/article/${this.realarticleId}`;
            $('#qr-code-center').html('');//避免重復(fù)生成二維碼
            $('#qr-code-center').qrcode({width: 180,height: 180,text: target_url});
            wx.scanQRCode({
              needResult: 0, // 默認(rèn)為0,掃描結(jié)果由微信處理,1則直接返回掃描結(jié)果,
              scanType: ["qrCode"], // 可以指定掃二維碼還是一維碼,默認(rèn)二者都有
              success: function (res) {
                var result = res.resultStr; // 當(dāng)needResult 為 1 時(shí),掃碼返回的結(jié)果
                console.log("result:aaaaaaa",result);
                //                    window.location.href = result;//因?yàn)槲疫@邊是掃描后有個(gè)鏈接,然后跳轉(zhuǎn)到該頁面
                sendShareArticle(`v1/tool/users/${localStorage.getItem("userId")}/wechatArticleShares/`,{
                  article_id:_this.realarticleId
                }).then((res)=>{

                },(err)=>{

                })
              }
            });
        },       

發(fā)現(xiàn)當(dāng)點(diǎn)擊這個(gè)分享按鈕的時(shí)候,二維碼掃描就回到了success(都還沒有進(jìn)行掃描),感覺很奇怪啊,正確的應(yīng)該是掃描完后才回調(diào)。

圖片:
圖片描述

哪位大神幫忙解答下

回答
編輯回答
情已空

solved by myself

2018年1月2日 22:51