【发布时间】:2020-05-29 10:29:43
【问题描述】:
我正在尝试将子路由器视图显示为周围组件的内容。
我的路由如下:
{
path: "/login",
name: "TheLoginView",
component: TheLoginView,
},
{
path: "/dashboard",
name: "TheDashboard",
component: () => import("@/views/TheDashboard"),
children: [
{
path: "",
name: "DashboardView",
component: () => import("@/components/dashboard/DashboardView"),
children: [
{
name: "Place Order",
path: "place-order",
component: () => import("@/views/ThePlaceOrderView"),
},
{
name: "Previous Orders",
path: "Past-orders",
component: () => import("@/components/ThePastOrders"),
},
{
name: "Account Options",
path: "account-options",
component: () => import("@/components/TheAccountOptions"),
},
],
},
],
},
我的仪表板组件如下所示:
<template>
<v-app>
<DashboardAppBar />
<DashboardNavDrawer />
<DashboardView />
<DashboardFooter />
</v-app>
</template>
我遇到的问题是 DashboardView 呈现在 navdrawer 下方,而不是旁边的预期结果。
我使用 v-app 或 v-content 的任意组合得到的结果如下:
目前 DashboardView 组件如下所示:
<template>
<router-view />
</template>
我有点不知道我需要更改/添加/删除什么才能让子路由器视图显示在抽屉旁边
【问题讨论】:
-
查看pre-made layouts 之一,尤其是"Complex" 以获取与您的需求相似的示例。
-
@YomS。不知道具体要看什么,但我尝试按照复杂示例格式化我的 DashboardView,但它并没有太大的不同:i.imgur.com/u7jcsMZ.png
-
@YomS。能够使用相关组件的 app 道具使其工作,我花了一点时间才弄清楚这就是缺少的东西。感谢您朝正确的方向轻推!
标签: javascript vue.js vuex vuetify.js