获取当前页面的地址url:
window.location.href
如: https://www.baidu.com/s?ie=UTF-8&wd=百度
获取 href 属性中跟在问号后面的部分及指定的参数
getQeuryVariable (variable) {
var test = window.location.search.substring(1)
let query = test.split('&')
for ( let i = 0; i < query.length; i++) {
let pair = query[i].split('=')
if (pair[0] === variable) {
return pair[1]
}
}
return false
}
getQeuryVariable (wd)
返回:百度
获取页面url及参数
猜你喜欢
转载自blog.csdn.net/LR13567/article/details/103654754
今日推荐
周排行