From aaeeb7e1d06aa8f947a1f87f4de75cc8022ba109 Mon Sep 17 00:00:00 2001 From: wangdong <1551135706@qq.com> Date: Tue, 17 Sep 2024 22:46:47 +0800 Subject: [PATCH] =?UTF-8?q?hash=E6=A8=A1=E5=BC=8F=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8E=A5=E5=8F=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 11 ++++++++++- manifest.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) 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" : {