我创建了两个选项卡,<li>默认情况下我希望第一个选项卡上的活动集类。
Then, when the second tab is selected, the .active class should pass to the second <li>and be removed from the first.
我可以使用 CSS 来创建一些样式规则,以便直观地显示当前处于活动状态的选项卡。
我还创建了一个JS Fiddle来查看当前输出。
欢迎任何帮助,因为我很困惑。
<ul class="overlay-panel-actions-primary">
<li v-for="(tab, index) in tabs" @click="currentTab = index">{{tab}}</li>
</ul>
<div class="content-bd">
<div class="tab-content">
<div v-show="currentTab === 0">
List of filters options
</div>
<div v-show="currentTab === 1">
List of sort options
</div>
</div>
</div>
new Vue({
el: "#app",
data() {
return {
currentTab: 0,
tabs: ['Filter', 'Sort']
};
},
})