Vue中watch使用

虽然 Vue.js 为我们提供了有用的 computed , 但在某些场景下, 仍然还是需要使用到 watch . 默认情况下, watch 只在被监听的属性值发生变化时执行. 例如: export default { data: () => ({ dog: "" }), watch: { dog(newVal, oldVal) { console.log(`Dog changed: ${newVal}`...