Vue访问去掉url地址栏中的#符号

要去掉Vue访问地址中的#符号可以在路由中设置路由模式mode为history

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
export default new Router({
mode: 'history',
routes: [{
path: '/',
name: 'Home',
component: Home
}, {
path: '/news',
name: 'News',
component: News
}, {
path: '/goods',
name: 'Goods',
component: Goods
}, {
path: '/detail/:id',
name: 'Detail',
component: Detail
}
]
})

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :