本练习中的观察者应该在每次“rangeVal”数据属性发生变化时将“count”数据属性加一。
观察者必须被称为什么?
<script>
const app = Vue.createApp({
data() {
return {
rangeVal: 70,
count: 0
}
},
watch: {
@(8)() {
this.count++
}
}
})
app.mount('#app')
</script>
<script>
const app = Vue.createApp({
data() {
return {
rangeVal: 70,
count: 0
}
},
watch: {
rangeVal() {
this.count++
}
}
})
app.mount('#app')
</script>