template代码是
<div class="news_title" v-on:click="news_title" > <ul> <li class="news_active" type1="0">篮球</li> <li type1="1">中超</li> <li type1="2">英超</li> <li type1="3">西甲</li> <li type1="4">德甲</li> <li type1="5">意甲</li> <li type1="6">幸运球场</li> </ul></div>
原jq代码是:
$(".news_title").on("click",'li',function(){ $(".news_title li").removeClass("news_active"); $(this).addClass("news_active"); var type=$(this).attr("type1"); });
请教下怎么迁移这个jq到vue上做点击事件呢?即点击li添加类名,兄弟去除类名.
看网上的方法都是要做for循环,请问下有不做for循环就能实现的方法吗?前提不要太复杂,蟹蟹
呼如林
相关分类