0
基于内容部分组件修改侧边栏组件这是我的模板部分:在Vue公司
<template>
<!-- START Home.vue section -->
<div class="container-fluid" v-if="user.authenticated">
<!-- START Sidebar.vue section -->
<sidebar-component></sidebar-component>
<!-- END Sidebar.vue section -->
<div class="main-container">
<!-- START Nav.vue section -->
<nav-component></nav-component>
<!-- END Nav.vue section -->
<!-- START Content Section -->
<router-view></router-view>
<!-- END Content Section -->
</div>
</div>
<!-- END Home.vue section -->
</template>
显然,有3个部分组成:NavComponent,SidebarComponent,将由路由组件更换主要部件区域。
我有另一个组件ApplicationList
组件,当将替换上述模板的router-view
部分,应该会导致侧栏组件行为不同(例如侧栏变为隐藏或其背景变为红色)。
那我该怎么做呢?
在你的路由器视图中,你将根据你所在的路径放置不同的组件,因此对于每个你希望侧栏以不同方式显示的组件,,,,,就是你想要的 –