假设我们的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
Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐