After generating the QR code, save it, and click Add Compilation Mode in the WeChat Developer Tools,
const en = encodeURIComponent("phone=15526262525&name=莹莹&company=1")
console.log(en);//phone%3D15526262525%26name%3D%E8%8E%B9%E8%8E%B9%26company%3D1
const scene = decodeURIComponent(options.scene);//解码
const arrstr = scene.split("&")
for (let i = 0; i < arrstr.length; i++) {
// console.log(arrstr[i].split('='))
const res = arrstr[i].split('=');
if (res[0] == 'phone') {
this.setData({
phone: res[1]
})
// staffPhone: data.phone,
// inviterUserName: data.name,
// corpId: data.company
wx.setStorageSync('staffPhone', res[1])
}
if (res[0] == 'name') {
this.setData({
name: res[1]
})
wx.setStorageSync('inviterUserName', res[1])
}
if (res[0] == 'company') {
this.setData({
company: res[1]
})
wx.setStorageSync('corpId', res[1])
}
}