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 '' } }