使用computed配合watch监听变量变化
data() {
return {
username:'',
password:''
}
},
computed: {
changeData() {
const {
username, password} = this
return {
username,
password
}
}
},
watch: {
changeData(e) {
//写入你需要监听的事件
}
},