【发布时间】:2018-01-02 03:02:06
【问题描述】:
我的 vue 模板:
<div
class="col-sm-4 col-xs-6 thumb"
v-for="(photo, index) in photos"
@click.prevent="check(index)"
>
<a class="thumbnail" :class="{'active': photo.checked}">
<img class="img-responsive" :src="photo.picture" alt="">
</a>
</div>
我的 check() 方法:
check(index) {
if(!("checked" in this.photos[index]))
this.photos[index].checked = true
else
this.photos[index].checked = !this.photos[index].checked
},
一切似乎都是正确的,但它不起作用。可能是什么问题?
【问题讨论】:
标签: vue.js vuejs2 vue-component vue-router