hash模式路由参数接受

h5
wangdong 5 months ago
parent 1d173bb8e2
commit aaeeb7e1d0
  1. 11
      App.vue
  2. 2
      manifest.json

@ -17,7 +17,7 @@
onLaunch({ path, query, scene }) {
console.log(this.$route);
// #ifdef H5
const storeId = this.$route.query.storeId;
const storeId = this.getQueryString('storeId');
console.log(storeId);
uni.setStorageSync('storeId', storeId || '');
// #endif
@ -43,6 +43,15 @@
methods: {
getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
},
// app
onStartupQuery(query) {
//

@ -153,7 +153,7 @@
}
},
"router" : {
"mode" : "history",
"mode" : "hash",
"base" : "./"
},
"devServer" : {

Loading…
Cancel
Save