博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vue修改对象的属性值后视图没有更新
阅读量:3937 次
发布时间:2019-05-23

本文共 198 字,大约阅读时间需要 1 分钟。

今天遇到一个奇怪的问题,修改了对象的属性值之后页面没有同步更新,说是官方解释vue不能检测到对象属性的添加或删除。但是用this.$set(obj,key,val)可以解决

代码如下:

1552574072(1)

这样就可以修改this.array[1]的那个对象为{type:3,title:“提现到银行卡”,checked:0}了。

还看到一种方法,可以强制刷新页面(没有测试过):this.$forceUpdate()

转载地址:http://azrgn.baihongyu.com/

你可能感兴趣的文章
3.9.3 - Sorting Lists
查看>>
3.10 - Maya Commands: ls
查看>>
3.11 - Dictionaries in Python
查看>>
3.12 - Tuples in Python
查看>>
4.4 - For Loops
查看>>
4.2.2 - Logical and/or Operators
查看>>
Lesson 4 Part 2 Softmax Regression
查看>>
文章中运用到的数学公式
查看>>
Projective Dynamics: Fusing Constraint Projections for Fast Simulation
查看>>
从2D恢复出3D的数据
查看>>
glm 中 数据类型 与 原始数据(c++ 数组)之间的转换
查看>>
Derivatives of scalars, vector functions and matrices
查看>>
the jacobian matrix and the gradient matrix
查看>>
VS2010 将背景设为保护色
查看>>
ubutun里面用命令行安装软件
查看>>
ubuntu 常用命令
查看>>
SQLite Tutorial 4 : How to export SQLite file into CSV or Excel file
查看>>
how to move pivot to origin
查看>>
Optimizate objective function in matrix
查看>>
Convert polygon faces to triangles or quadrangles
查看>>