File tree 2 files changed +17
-9
lines changed
2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -181,12 +181,16 @@ <h4> {% fa_svg fas.fa-paperclip %} 友情链接 </h4>
181
181
< h4 class ="modal-title " id ="isoModalLabel "> 获取安装镜像</ h4 >
182
182
</ div >
183
183
< div class ="modal-body ">
184
- < div class ="row ">
184
+ < div class ="row " v-if =" availableCategories.length > 0 " >
185
185
< div class ="col-md-12 ">
186
186
< ul class ="nav nav-tabs ">
187
- < li role ="presentation " :class ="[curCategory === 'os' ? 'active' : ''] " @click ="switchCategory('os') " v-show ="showCategory('os') "> < a href ="# "> 操作系统</ a > </ li >
188
- < li role ="presentation " :class ="[curCategory === 'app' ? 'active' : ''] " @click ="switchCategory('app') " v-show ="showCategory('app') "> < a href ="# "> 应用软件</ a > </ li >
189
- < li role ="presentation " :class ="[curCategory === 'font' ? 'active' : ''] " @click ="switchCategory('font') " v-show ="showCategory('font') "> < a href ="# "> 字体</ a > </ li >
187
+ < li role ="presentation "
188
+ v-for ="cat in availableCategories "
189
+ :class ="[curCategory === cat ? 'active' : ''] "
190
+ @click ="switchCategory(cat) "
191
+ >
192
+ < a href ="# "> {{ knownCategories[cat] ? knownCategories[cat] : cat }}</ a >
193
+ </ li >
190
194
</ ul >
191
195
</ div >
192
196
< div class ="col-md-3 ">
Original file line number Diff line number Diff line change @@ -189,12 +189,20 @@ var vmIso = new Vue({
189
189
data : {
190
190
distroList : [ ] ,
191
191
selected : { } ,
192
- curCategory : "os"
192
+ curCategory : "" ,
193
+ knownCategories : {
194
+ os : "操作系统" ,
195
+ app : "应用软件" ,
196
+ font : "字体" ,
197
+ } ,
198
+ availableCategories : [ ]
193
199
} ,
194
200
created : function ( ) {
195
201
var self = this ;
196
202
$ . getJSON ( "/static/status/isoinfo.json" , function ( isoinfo ) {
197
203
self . distroList = isoinfo ;
204
+ self . availableCategories = [ ... new Set ( isoinfo . map ( ( x ) => x . category ) ) ]
205
+ self . curCategory = self . availableCategories [ 0 ] ;
198
206
self . selected = self . curDistroList [ 0 ] ;
199
207
if ( window . location . hash . match ( / # i s o - d o w n l o a d ( \? .* ) ? / ) ) {
200
208
$ ( '#isoModal' ) . modal ( ) ;
@@ -211,10 +219,6 @@ var vmIso = new Vue({
211
219
} ,
212
220
} ,
213
221
methods : {
214
- showCategory ( category ) {
215
- return this . distroList
216
- . findIndex ( ( x ) => x . category === category ) > - 1 ;
217
- } ,
218
222
switchDistro ( distro ) {
219
223
this . selected = distro ;
220
224
} ,
You can’t perform that action at this time.
0 commit comments