From fb332bf0a57b0f1f8883457b7122d621b62fc605 Mon Sep 17 00:00:00 2001 From: zhangguoping Date: Mon, 2 Sep 2024 10:09:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8Furl=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.vue | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1d72498..ab3258e 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -50,29 +50,8 @@ const srcList = reactive({ }) const getUrlPathName = () => { - const url = window.location.href - if (url.indexOf('#/') !== -1) { - let strR = '' - const str = - url.indexOf('#/') !== -1 ? url.split('#/')[1] : url.split('/')[url.split('/').length - 1] - if (str.indexOf('/') === -1) { - strR = str || '' - } else { - strR = str.split('/')[0] - } - if (strR.indexOf('-') === -1) { - code = 'activity' - } else { - code = strR.split('-')[0] - strR = strR.split('-')[1] - } - return strR - } else if (url.indexOf('?') !== -1) { - let strR = '' - strR = url.split('=')[1] - code = strR.split('-')[0] - return strR.split('-')[1] - } else { + const url = window.location.pathname + try { const str = url.split('/') const strP = str[str.length - 1] let strR = '' @@ -84,6 +63,8 @@ const getUrlPathName = () => { strR = strP.split('-')[1] } return strR + } catch { + return '' } }