我是靠谱客的博主 飞快太阳,这篇文章主要介绍2022-03-24 vue监听值改变,现在分享给大家,希望可以做个参考。

组件中使用接受queryParams参数

export default {
...
//组件传递queryParams
props: {
queryParams:{
type: Object
}
},
...
watch: {
//监听queryParams的值如果改变,重新请求list
queryParams: {
handler(val) {
let that = this
getList(this.queryParams).then((response) => {
that.data = response.data
})
},
deep: true,
},
}
...

父页面传入queryParams参数

...
data() {
return {
queryParams:{}
}
}
...
//在change事件中修改queryParams的值
change(val){
this.queryParams = {id:val.id}
}
...

最后

以上就是飞快太阳最近收集整理的关于2022-03-24 vue监听值改变的全部内容,更多相关2022-03-24内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(170)

评论列表共有 0 条评论

立即
投稿
返回
顶部