404页面路由不要写在静态路由中,这样就会导致动态路由还未加载出来,就跳转。
404路由写在动态路由中:
outer.addRoutes([{
path: '/page',
name: 'page',
component: pageBox,
children: childTree
},{//404
path: '/404',
component: page404
},
{ //重定向到404
path: '*', redirect: '/404' }])