1.js文件头部导入截取方法
let utils = require("../invitation/utils.js")onLoad: function (options) {console.log('扫描二维码进入传递的参数',decodeURIComponent(options.q))if(options.q){let q = decodeURIComponent(options.q);console.log("传递的第一个参数为" + utils.getQueryString(q, 'memberId'))var memberIds = utils.getQueryString(q, 'memberId');console.log(memberIds);}},
2.utils文件
let getQueryString = function (url, name) {var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')var r = url.substr(1).match(reg)if (r != null) {return r[2]}return null;}module.exports = {getQueryString: getQueryString}