【JavaScript】获取url中的参数方法封装
getParams() {
const url = window.location.href
const index = url.indexOf('?') + 1
const params = url.substr(index)
const arr = params.split('&')
const o = {}
for (var i = 0; i < arr.length; i++) {
var tmpArr = arr[i].split('=')
var key = tmpArr[0]
var value = tmpArr[1]
o[key] = value
}
return o
}