vue-test ------事件监听
<template>
<h3>监听器</h3>
<p>{{message}}</p>
<button @click="updateHandle">点击</button>
</template>
<script>
export default {
name: "WatchDemo",
data(){
return{
message:"hello"
}
},
methods:{
updateHandle(){
this.message="no hello"
}
},
watch:{
message(newValue,oldValue){
console.log(newValue,oldValue)
}
}
}
</script>
<style scoped>
</style>