state(){
return{filterParams:[] /** set array */
}} ,
mutations: {
updateFilterParams(state,res){
let filterParams=state.filterParams;
let len=filterParams.length;if(!len){
state.filterParams.push(res);
}else{
let key=filterParams.findIndex(e => e.name === res.name);
if(key>=0){/**Direct assignment will not trigger the getter method to refresh*/
//state.filterParams[key]=res;
/***Convert the object, and then re-assign, it can be resolved*/
state.filterParams[key ]=JSON. parse(JSON. stringify(res));
}}
}
}
Component monitoring: need to add deep:true .
watch(() => store.state.filterParams,(ov,nv)=>{
/**Related monitoring code**/
},{deep:true});