正式url获取值
This commit is contained in:
parent
56f9356a48
commit
fb332bf0a5
|
@ -50,29 +50,8 @@ const srcList = reactive<SrcListType>({
|
|||
})
|
||||
|
||||
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 ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue