当前位置:网站首页>Uniapp modifies array properties, and the view is not updated

Uniapp modifies array properties, and the view is not updated

2022-06-22 23:21:00 Evil and evil

principle : The reason why the view is not updated , Because there is no corresponding attribute defined in the array , The solution is to define attributes for the array ,uniapp And vue equally , It is not supported to dynamically add attributes to an object after the instance is created , If you want to dynamically add object attributes , Then it is not possible to use the conventional method , Only by special means , such as this.$set

One :this.$forceUpdate(); Force update ( Golden finger , Invincible plug-in , Refresh the entire page )

that.msg.MediaList[that.audioId].currentTime = '00:00';
that.$forceUpdate();

Two :this.$set()

_this.$set(_this.msg.MediaList[index], 'currentTime', '00:00');
原网站

版权声明
本文为[Evil and evil]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222056247756.html