微信小程序扫描普通二维码打开微信小程序
uniapp前端设置
onLoad:function(options){ if (JSON.stringify(options) == "{}") { } else { this.posts_id = options.id; if (options.q) { //1.将二维码链接解码 let codeStr = decodeURIComponent(options.q) //2.取出对应参数 const codeId = codeStr.match(/[?&]id=(\d+)/) this.posts_id = codeId[1]; } com.share(options.shareid); } }