监视属性 使用方式第一种12345678910111213141516171819202122232425262728const vm = new Vue({ el:"#root", data:{ isHot:true, }, methods: { qiehuan() { this.isHot = !this.isHot this.x++ } }, computed: { info(){ return this.isHot?"炎热":"凉爽" } }, watch: { info:{ // immediate:"true", handler(newValue,oldValue){ console.log("isHot被修改了",newValue,oldValue) } } }, }) 第二种12345678vm.$watch("isHot", { immediate: "true", handler(newValue, oldValue) { console.log("isHot被修改了", newValue, oldValue) } })