记录背景:
今天在调试前后端接口时,测试从浏览器、PC、微信页面路径无参均正常,但微信菜单跳转页面之后,再次跳转页面(此时页面路径带参)在该页面点击“查看产品详情”按钮,发现已经跳转,但详情页面动态数据未加载,点击刷新才加载!(调动ocr接口识别身份证信息也是如此),利用以下方法才得以解决!暂作记录。
2019.05.15 15:56:00 浦东张江 阴18-22
带参的页面
<p class="info-more" @click="prdc_details(o)">查看产品详情</p>
prdc_details(o){
let url = 'http://127.0.0.1:8080/test?id_1='+o.id_1+"&id_2="+o.id_2;
window.location.href = url;
}
要跳转的页面获取参数
created() {
this.getParams();
},
methods: {
getParams () {
var url = location.search;
var theRequest = new Object();
if(url.indexOf("?") != -1){
var str = url.substr(1);
var strs = str.split("&");
for(var i = 0;i < strs.length;i++) {
theRequest[ strs[i].split("=")[0] ] = (strs[i].split("=")[1]);
}
}
this.id_1=theRequest.id_1;
this.id_2=theRequest.id_2;
}
}