vue-router的base和mode配置项
vue-router的base和mode配置项 路由代码如下:const router = new VueRouter({mode: 'history',base: '/vue',routes}) 1) mode mode: 'history’表示,访问路径不带#号,如:http://localhost:8080/vue 2) base 配置单页应用的基路径,当点击路由时:<ro
·
vue-router的base和mode配置项
路由代码如下:
const router = new VueRouter({
mode: 'history',
base: '/vue',
routes
})
1) mode
mode: 'history’表示,访问路径不带#号,如:http://localhost:8080/vue
2) base
配置单页应用的基路径,当点击路由时:
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
会带上项目基路径,如:http://localhost:8080/vue/about
浏览器地址栏http://localhost:8080/vue/这样访问,表示是访问该项目
更多推荐
已为社区贡献13条内容
所有评论(0)