要去掉vue中访问地址中的#符号可以在路由器中设置路由模式为history:
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
}
]
})
效果如下: