今天要做一个h5页面,用来打开app的,现在要获取url带的参数
created() {
const queryUrl = this.getRequest()
let urlParams = Object.assign(queryUrl, this.$route.query) //参数合并
if (urlParams.id) {//id是路径带的参数
console.log('urlParams ==>', queryUrl.id)
this.id = queryUrl.id
};
this.downApp();
},
methods: {
getRequest() {
var url = decodeURIComponent(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]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
},
}
博客主要讲述要制作一个用于打开app的h5页面,当前任务是获取url携带的参数,涉及前端开发相关内容。
1817

被折叠的 条评论
为什么被折叠?



