<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                App.vue ``` onShow: function(e) { // #ifdef MP-WEIXIN //獲取二維碼攜帶的參數 let scene = decodeURIComponent(e.query.scene) scene = scene.split('&') let data = { //場景值 scene: e.scene } scene.forEach(item => { let arr = item.split('=') if (arr.length === 2) { data[arr[0]] = arr[1] } }) console.log('小程序場景值(App)', data,e.query) ``` -------------------------------------------------------------------- # 【uniapp】小程序的scene解碼 今天在小程序接收scene的數據時,發現“:”冒號被解析成了“%”,后面運用到了decodeURIComponent()就很好地解決了問題,特此記錄。 ``` /** * scene解碼 */ scene_decode(e) { if (e === undefined) return {}; let scene = decodeURIComponent(e), params = scene.split(','), data = {}; for (let i in params) { var val = params[i].split(':'); val.length > 0 && val[0] && (data[val[0]] = val[1] || null) } return data; }, ``` # 微信小程序判斷進入小程序的入口(場景值) 微信開發者文檔:https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html 1、場景值用于判斷用戶是從什么地方進入的小程序。 2、場景值主要是通過這兩個函數來傳遞onLoauch 和 onShow函數: ``` onShow: function(options) { let option = JSON.stringify(options); console.log('app.js option-----' + option) console.log('app.js>>options.scene--------------------' + options.scene); var resultScene = this.sceneInfo(options.scene); console.log(resultScene); }, //場景值判斷 sceneInfo: function(s) { var scene = []; switch (s) { case 1001: scene.push(s, "發現欄小程序主入口"); break; case 1005: scene.push(s, "頂部搜索框的搜索結果頁"); break; default: scene.push("未知入口"); break; } return scene; } // 其中只有在傳遞 1020、1035、1036、1037、1038、1043 這幾個場景值時,才會返回referrerInfo.appId ``` 使用場景,例如 ``` // #ifdef MP-WEIXIN //如果入口為1036, 1107, 1043,清除路由層級 if ([1036, 1107, 1043].includes(options.scene)) { this.$navigator.clear() } // #endif ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看