export function getUrlHashParams(paramName: string): string | null {
// const hash = new URL(
// 'https://www.xxx.com/xxx/xxx?xx=xxx#/docflow/inbiz?id=docidid&dadasdas=123456'
// ).hash.substring(1) // 去除 '#' 符号
const hash = window.location.hash.substring(1) // 去除 '#' 符号
const queryIndex = hash.indexOf('?')
if (queryIndex !== -1 && queryIndex < hash.length - 1) {
const queryString = hash.substring(queryIndex + 1)
const params = new URLSearchParams(queryString)
return params.get(paramName)
}
return null
}
js指定获取地址栏参数(hash地址后面)
于 2023-06-19 16:33:20 首次发布