diff --git a/App.vue b/App.vue index 33407f9..ba0825c 100644 --- a/App.vue +++ b/App.vue @@ -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 @@ -42,6 +42,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) { diff --git a/manifest.json b/manifest.json index 6274116..8031dc4 100644 --- a/manifest.json +++ b/manifest.json @@ -153,7 +153,7 @@ } }, "router" : { - "mode" : "history", + "mode" : "hash", "base" : "./" }, "devServer" : {