let URL = http://localhost:8080/#/ficu/?taskid=1001-2271023&pageId=146&ssid=74529457205982&channelld=IPCC&userId=xx
// 取值URL
let href = window.location.href // 拿到完整的URL
let hash = window.location.hash // 取#后面的所有URL
// 取值方法
getUrlParams () {
let hash = window.location.hash
console.log('-------hash---', hash)
// 输出#/ficu/?taskid=1001-2271023&pageId=146&ssid=74529457205982&channelld=IPCC&userId=xx
let obj = {}
let urlStr = hash.split('?')[1] // 取问号后面的值
let params = urlStr.split('&')
for (let i=0, len=params.length; i<len; i++) {
let arr = params[i].split('=')
obj[arr[0]] = arr[1]
}
return obj
}
// 用法
let objList = this.getUrlParams()
objList.pageId = '146'
console.log('-----objList----', objList)
// 输出对象-----objList----
{
taskid: '1001-2271023'
pageId: '146'
ssid: '74529457205982'
channelld: 'IPCC'
userId: 'xx'
}