vue项目获取url参数

版权声明:本文为博主原创文章,如需转载请务必注明原地址。 https://blog.csdn.net/qq_31393401/article/details/82699847

假设我们的url是http://www.demo.com/#/?channel=123&user=user
#前的内容不影响

hash模式

import Qs from 'qs'
const query = Qs.parse(location.hash.substring(3))
let channel = query.channel
let user = query.user

history模式

import Qs from 'qs'
const query = Qs.parse(location.search.substring(1))
let channel = query.channel
let user = query.user

猜你喜欢

转载自blog.csdn.net/qq_31393401/article/details/82699847