Hide tab in iso modal when there are no items

This commit is contained in:
Jiajie Chen 2020-08-07 16:22:20 +08:00
parent 96c01f1658
commit 898ba05bfc
2 changed files with 10 additions and 6 deletions

View File

@ -150,9 +150,9 @@
<div class="row">
<div class="col-md-12">
<ul class="nav nav-tabs">
<li role="presentation" :class="[curCategory === 'os' ? 'active' : '']" @click="switchCategory('os')"><a href="#">操作系统</a></li>
<li role="presentation" :class="[curCategory === 'app' ? 'active' : '']" @click="switchCategory('app')"><a href="#">应用软件</a></li>
<li role="presentation" :class="[curCategory === 'font' ? 'active' : '']" @click="switchCategory('font')"><a href="#">字体</a></li>
<li role="presentation" :class="[curCategory === 'os' ? 'active' : '']" @click="switchCategory('os')" v-show="showCategory('os')"><a href="#">操作系统</a></li>
<li role="presentation" :class="[curCategory === 'app' ? 'active' : '']" @click="switchCategory('app')" v-show="showCategory('app')"><a href="#">应用软件</a></li>
<li role="presentation" :class="[curCategory === 'font' ? 'active' : '']" @click="switchCategory('font')" v-show="showCategory('font')"><a href="#">字体</a></li>
</ul>
</div>
<div class="col-md-3">

View File

@ -186,15 +186,19 @@ var vmIso = new Vue({
});
},
computed: {
curDistroList () {
curDistroList() {
return this.distroList
.filter((x)=> x.category === this.curCategory)
.filter((x) => x.category === this.curCategory)
.sort(function (a, b) {
return a.distro.localeCompare(b.distro);
});
}
},
},
methods: {
showCategory(category) {
return this.distroList
.findIndex((x) => x.category === category) > -1;
},
switchDistro (distro) {
this.selected = distro;
},