vue哈希路由获取网址回调get的值(get网址参数成对象形式)
好好学习 ,天天向上。Are you ready?代码奉上!!!!!!!!!let hashUrl = window.location.hashlet url = hashUrl.substring(hashUrl.indexOf('?') + 1, hashUrl.length)let arr = (url).replace(/^\#/, '').split('&...
·
好好学习 ,天天向上。Are you ready?
代码奉上!!!!!!!!!
let hashUrl = window.location.hash
let url = hashUrl.substring(hashUrl.indexOf('?') + 1, hashUrl.length)
let arr = (url).replace(/^\#/, '').split('&')
let params = {}
for (let i = 0; i < arr.length; i++) {
let data = arr[i].split('=')
if (data.length === 2) {
params[data[0]] = data[1]
}
}
return params
更多推荐
已为社区贡献3条内容
所有评论(0)