vue项目的url去掉#
在router/index.js 加上 mode: ‘history’,例子: mode: ‘history’,routes: [{path: ‘/’, //首页name: ‘HelloWorld’,component: HelloWorld},
·
在router/index.js 加上 mode: ‘history’,
例子:
mode: 'history',
routes: [
{
path: '/', //首页
name: 'HelloWorld',
component: HelloWorld
},
如果你是这样定义路由的,你可以
const routes = [
{
path:'/',
redirect:'',
component:Index
}
]
const router = new VueRouter({
mode:'history',
routes
})
更多推荐
已为社区贡献31条内容
所有评论(0)