vue 父页面给子页面传值,子页面没有实时刷新的问题

场景:vue父页面传值,参数为plant,

问题:父页面改变plant的值,子页面没有实时更新

解决方法:

1.父页面参数加一个 .sync

< hqlist :plant.sync=" plante" ></ hqlist >


2.子页面watch 参数的变化,并执行function

watch:{
plant( value, oldvalue){
this. plant = value;
this. getCompanyList();
}
}

猜你喜欢

转载自blog.csdn.net/young_gao/article/details/80283336