为了账号安全,请及时绑定邮箱和手机立即绑定

vue双v-for数据如何分别点击添加active

vue双v-for数据如何分别点击添加active

回首忆惘然 2018-08-26 14:53:50
 <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>数据结构是这样的"list": {    "trade": {        "title":"行业分类",        "items":["不限","家电","3C","汽车","食品","电气/照明","日化/化工","医疗/医药","五金","家具/木材","其他"]     },    "fn":{        "title":"功能分类",        "items":["不限","组装","检测","分拣","包装","焊锡","涂装","焊接","冲压","注塑","搬运","其他"]     },    "area":{        "title":"区域",        "items":["不限","上海市","广东省","湖北省","江苏省","浙江省","重庆市","天津市","山东省","北京市"]     } }在点击事件里怎么写才能写出三个分类分别添加active,而不相互影响,如果分别写三个循环是可以达到结果预期,不过代码蠢自己都看不下去了 求大神们帮忙看看
查看完整描述

1 回答

?
慕容708150

TA贡献1831条经验 获得超4个赞

scss 
.class-list{

&:first-child{
    &.active{
        h3{
        }
        span{
        }
    }
}
&:nth-child(2){
    &.active{
        h3{
        }
        span{
        }
    }
    }
&:last-child{
    &.active{
        h3{
        }
        span{
        }
    }
}

}


查看完整回答
反对 回复 2018-08-27
  • 1 回答
  • 0 关注
  • 1570 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信