uniapp 掃碼開啟小程式
阿新 • • 發佈:2020-09-19
if (options.q !== undefined) { // 掃碼後接收到的引數 var url = decodeURIComponent(options.q) console.log(url) var scanParamsQrcode = this.$myApi.getUrlParamsApi(url) console.log(scanParamsQrcode)this.$myApi.scann(scanParamsQrcode) return // var pos_id = scanParams.pos_id // var pos_type_id = scanParams.pos_type_id // var is_scan = scanParams.is_scan // this.$myApi.jumpVuePosFindApi(pos_id)}
api.getUrlParamsApi = (url)=> { var urlArray = url.split('?') var url_params = '?'+urlArray[1] // console.log(url_params) var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url_params.substr(1); var strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]); } } return theRequest; }