Vue中展示二级路由的默认模块 若依框架 自定义指令权限的使用说明
import Vue from 'vue' import Router from 'vue-router' import goodinfo from '../components/goodinfo' import detail from '../components/goodinfodetails/detail' Vue.use(Router) export default new Router({ routes: [ {path:'/goodinfo',name:'goodinfo',component:goodinfo,children:[ {path:'/detail',component:detail}, {path:'/review',component:review} ],redirect:'/detail'//在children的后面加一个redirect:'/想要默认展示的子路由名字' }, ] })
样就大功告成了!页面每次刷新都会默认展示redirect设置后的子路由
若依 参考: https://blog.csdn.net/liuzixin_lzx/article/details/113655106