<template> <div> <!-- 监听值的改变: --> <button class="th" @click="add">添加</button> <input v-model="count" type="text"> </div> </template> <script> export default { data() { return { count:0 }; }, methods: { add(){ this.count++; } }, watch: { count:function(new value,oldvalue){ console.log("a的值是"+a) console.log("b的值是"+b) } } }; </script>