console.log('测试跳转小程序');
let query ={
Code: "测试跳转小程序",
Url: "",
brandId: "",
userId: "",
userName: ""
}
// 把对象转换成 a=1&b=2&c=3&d=4 的字符串格式
let queryString = Object.keys(query).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`).join('&')
// 对其进行转码
let res = encodeURIComponent(queryString)
console.log('queryString',queryString);
window.location.href = "weixin://dl/business/?appid=xxxxxxxx&path=pages/index/Index&env_version=trial&query="+res;
小程序使用onload函数,获取被调用时收到的参数即可
补充
关于微信平台使用明文Scheme的规则描述:
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-scheme.html