vue数据改变视图不更新解决方案

前后端联调时有时候前端需要对后端数据格式调整,对于复杂类型数据,有时候通过click事件赋值操作视图却没有更新,可以通过$forceUpdate()事件处理

handleClick(e) {
				this.list[e].child.flag = true
				this.$forceUpdate();
			}

在赋值逻辑下面加上this.$forceUpdate();

猜你喜欢

转载自blog.csdn.net/Dajdhushvj/article/details/125494644