【发布时间】:2019-07-08 22:28:06
【问题描述】:
我正在尝试使我的内容组件动态化。(使用 vue-router)
这是我的代码:
<template>
<div class="row mb-3" id="customer-panel">
<Breadcrumb></Breadcrumb>
<CustomerSidebar></CustomerSidebar>
<div class="col-lg-9">
<PersonalInfo></PersonalInfo>
</div>
</div>
</template>
除PersonalInfo组件外,所有页面中的任何内容均已修复。
这是我的路线:
{
path: '/customer',
component: Profile,
redirect: '/customer/profile',
children: [
{
path: 'profile',
name: 'profile',
component: Profile
},
{
path: 'order',
name: 'order',
component: Order
},
]
}
我该怎么办?
我不想在另一个组件中重复我的代码并复制和过去。 我只想在去订单路线时加载订单组件而不是 PersonalInfo。
最好的方法是什么?
【问题讨论】:
标签: vue.js vue-component vue-router