new Vue({
el:'html',
data(){
return{
...
needreceipt:true,
...
}
},
watch:{
'needreceipt':function (val) {
console.log(val);
}
},
...
})
<input id="fapiao" class="check" name="style" type="checkbox" v-model="needreceipt">
<label for="fapiao" class="trigger"><i></i>{{needreceipt}}</label>
label中的内容正确变化,为什么watch里的function不会执行
copy 你的代码,试过试可以执行的,没问题。
Codepen