【发布时间】:2019-02-22 14:47:29
【问题描述】:
我在加载 http://localhost:8080/myapps/config 路由时遇到问题。如果我使用 http://localhost:8080/myapps 一切正常,我会得到我的应用程序列表。但是当我想通过http://localhost:8080/myapps/config 访问应用程序配置时,它会再次加载 /myapps 的内容。但是,我浏览器中的 url 显示了正确的路径 /myapps/config。
我已经检查路由器几个小时了,但似乎一切正常。有人能解释一下吗?
我的路由器文件:
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.js vue-router