redirect
初始化路由时设置
let router = new VRouter({ // 如果mode设为history, 那么地址就可以不使用哈希(# 哈希)了,就可以直接访问. http://localhost:8080/#/apple ==>> http://localhost:8080/apple
mode: 'history', routes: [
{ //当路径为'/'时,重新跳转到apple
path: '/', //设置重定向
redirect: '/apple'
},
{ path: '/apple',
......
},
{ path: '/banana',
......
}
]
})相信看了本文案例你已经掌握了方法,更多精彩请关注Gxl网其它相关文章!
推荐阅读:
Vue.js的单位件组件
Vue.js如何设置路由
下载本文