vue computed+watch监听数据变化
vue computed+watch监听数据变化
data(){
return{
listQuery: {
QueryInfo: null,
PageNo: 1,
PageSize: 50
},
}
}
computed: {
QueryInfo: function() {
return this.listQuery.QueryInfo
}
},
watch: {
QueryInfo: function(val) {
// 这里函数
if (val === '') {
this.getList()
}
}
},
直接用computed+watch监听
本文介绍了一个使用Vue.js的computed属性和watch监听器结合的方法来监听数据变化的具体实现案例。通过这种方式,可以实现在数据发生变化时执行特定操作,例如重新加载列表。

463

被折叠的 条评论
为什么被折叠?



