Vue.js Vue路由器不遵循子路径
我的路线装载有问题。如果我使用一切正常,我会得到我的应用程序列表。但当我想通过它访问应用程序配置时,会再次加载/myapps的内容。但是,我的浏览器中的url显示了正确的路径/myapps/config 我已经检查了几个小时的路线,但一切似乎都很好。有人能解释一下吗 我的路由器文件:Vue.js Vue路由器不遵循子路径,vue.js,vue-router,Vue.js,Vue Router,我的路线装载有问题。如果我使用一切正常,我会得到我的应用程序列表。但当我想通过它访问应用程序配置时,会再次加载/myapps的内容。但是,我的浏览器中的url显示了正确的路径/myapps/config 我已经检查了几个小时的路线,但一切似乎都很好。有人能解释一下吗 我的路由器文件: import Vue from 'vue' import Router from 'vue-router' const MyApps = () => import('../views/app/subview
import Vue from 'vue'
import Router from 'vue-router'
const MyApps = () => import('../views/app/subviews/MyApps');
const AppKeyValue = () => import('../views/app/subviews/AppKeyValue');
import MainView from '../views/app/MainView'
Vue.use(Router)
export default new Router({
mode: 'history',
routes:
[
{
path: '/',
component: MainView,
redirect: 'myapps',
children:
[
{
path: 'myapps',
component: MyApps,
meta:
{
requiresAuth: true,
breadcrumb: 'My Apps'
},
children:
[
{
path: 'config',
component: AppKeyValue,
meta:
{
requiresAuth: true,
breadcrumb: 'App configuration'
}
},
]
},
]
},
]
})
如果不使用子路由,一切正常:
export default new Router({
mode: 'history',
routes:
[
{
path: '/',
component: MainView,
redirect: 'myapps',
children:
[
{
path: 'myapps',
component: MyApps,
meta:
{
requiresAuth: true,
title: 'message.ecommerce',
breadcrumb: 'My Apps'
},
},
{
path: 'myapps/config',
component: AppKeyValue,
meta:
{
requiresAuth: true,
title: 'message.ecommerce',
breadcrumb: 'App configuration'
}
}
]
}
]}
您没有发布
*.vue
组件,但我假设您在第二级组件中缺少
例如:
MainView
映射到/
,并有一个子路由(/myapps
)。您可能正在主视图中使用
MyApps
作为/
-路由的子路由映射到MyApps
,并且有一个子路由(/config
)
添加一个您在myapps中是否有一个?