组件中使用接受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}
}
...