标签:ted eve trim decode option iap use uri ext
在h5和wxapp中
computed: {
...mapState([‘userinfo‘]),
val() {
let val = ‘‘;
// h5直接跳网址
// #ifdef H5
val = `https://www.xxx.net/pages/register/register?code=${this.userinfo.code}`;
// #endif
// 微信小程序按按照小程序规则跳转
// #ifdef MP-WEIXIN
// 测试的时候,填写测试链接,测试好了改为动态数据
val = `https://www.xxx.net?code=123`;
// #endif
return val;
}
}
onLoad(options) {
// #ifdef H5
if (options && ‘code‘ in options) {
this.icode = options.code.trim();
}
// #endif
// #ifdef MP-WEIXIN
if (options && ‘q‘ in options) {
const q = decodeURIComponent(options.q);
const querys = q
.split(‘?‘)[1]
.split(‘&‘)
.reduce((acc, it) => {
let r = it.split(/=/);
return Object.assign(acc, {
[r[0]]: r[1]
})
}, {});
if (‘code‘ in querys) {
this.icode = querys.code.trim();
}
}
// #endif
}
标签:ted eve trim decode option iap use uri ext
原文地址:https://www.cnblogs.com/ajanuw/p/13379926.html