<div class='class-list'
v-for='(value, key) in list'
:key='key'>
<h3>{{value.title}}</h3>
<span class='class-item'
:class='{active: index === isActive}'
v-for='(item,index) in value.items'
:key='item'
@click='handleSortItemClick(index,value)'
>{{item}}
</span>
</div>數(shù)據(jù)結(jié)構(gòu)是這樣的"list": { "trade": { "title":"行業(yè)分類", "items":["不限","家電","3C","汽車","食品","電氣/照明","日化/化工","醫(yī)療/醫(yī)藥","五金","家具/木材","其他"]
}, "fn":{ "title":"功能分類", "items":["不限","組裝","檢測(cè)","分揀","包裝","焊錫","涂裝","焊接","沖壓","注塑","搬運(yùn)","其他"]
}, "area":{ "title":"區(qū)域", "items":["不限","上海市","廣東省","湖北省","江蘇省","浙江省","重慶市","天津市","山東省","北京市"]
}
}在點(diǎn)擊事件里怎么寫才能寫出三個(gè)分類分別添加active,而不相互影響,如果分別寫三個(gè)循環(huán)是可以達(dá)到結(jié)果預(yù)期,不過代碼蠢自己都看不下去了 求大神們幫忙看看
vue雙v-for數(shù)據(jù)如何分別點(diǎn)擊添加active
回首憶惘然
2018-08-26 14:53:50