如何在vue.js中切换类?
我有以下几点:
<th class="initial " v-on="click: myFilter">
<span class="wkday">M</span>
</th>
new Vue({
el: '#my-container',
data: {},
methods: {
myFilter: function(){
// some code to filter users
}
}
});
当我单击<th>
标签时,我希望应用active
作为类,如下所示:
<th class="initial active" v-on="click: myFilter">
<span class="wkday">M</span>
</th>
这需要切换,即每次单击它都需要添加/删除类.