The view is not refreshed after vue computed modification.

Link description

after clicking to edit, the newTodos data has changed, but the display on the interface is still old, and there is no save button.

May.14,2021

probably take a look at the code, your posture of using computed is wrong, computed is generally used to do getter of vm attributes, you modify newTodos directly in edit is an anti-pattern, you can not enjoy the responsive features of vue.

the right thing to do is to change the this.todos directly in edit, and newTodos that depends on this.todos will automatically change due to responsive relationships.

and there are other problems. In general, it is best to declare all the properties on the vm of vue at one time, with default values, and then, if you have to add new attributes, use Vue.set to complete the assignment instead of directly.


you need to operate in set, and you can't change the value of newTodos directly. Its value is obtained through get.

< hr > In

computed, you always get the data through get, but you don't change the value of todos at all; as in the following answer, using computed pose is not correct


item.is_edit = false
define new property listeners directly cannot
use $set

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d8ba-2c396.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d8ba-2c396.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?