【发布时间】:2020-07-02 12:16:24
【问题描述】:
我有一个侧边栏组件,我想使用两次,但其中包含不同的其他组件。
我真的很想这样工作:
<template>
<Sidebar class="left-0">
<ExampleComponentA/>
</Sidebar>
<Content/>
<Sidebar class="right-0">
<ExampleComponentB/>
</Sidebar>
</template>
Vue 是否有可能,还是我真的需要一个 SidebarLeft 和一个 SidebarRight 组件?
<template>
<SidebarLeft class="left-0"/> <!-- <ExampleComponentA/> is in this Component -->
<Content/>
<SidebarRight class="right-0"/> <!-- <ExampleComponentB/> is in this Component -->
</template>
我为什么要那样做?
好吧,我的侧边栏设置是一样的,只是 content 不同。所以我不需要复制洞边栏。
【问题讨论】:
标签: javascript vue.js components