var city = new Vue({
el:'.city',
data:{
choices:[
{cities:'北京'},
{cities:'上海'},
{cities:'福州'},
{cities:'广州'},
{cities:'青岛'}
]
},
methods:{
changeCity:function(){
$(this).css('color','red').siblings().css('color',''); //问题在这里,这里的this好像不是指向点击的那个元素,好像是指向vue里面的,该怎么办?
}
}
});<p class="city"> 切换城市:
<a href="#" v-on:click="changeCity" v-for="item in choices">
{{item.cities}}
</a>
</p>
添加回答
举报
0/150
提交
取消