The problem of changing the properties of the object and not refreshing the view in the vue component

when an object collocateval, is defined in vue"s data data center and properties are added or modified to collocateval when an event is triggered, the view on the page will not be updated by Synchronize, but will be updated by Synchronize only when other data has changed
code is as follows:

Ask God to tell me whether

clipboard.png
vue.set

clipboard.png

vue
clipboard.png
is written incorrectly in the component.

Mar.04,2021

Vue is based on Object.defineProperty and implements almost painless state listening by replacing the attribute with getter/setter. This process occurs when the component is initialized, and the properties of all the variables you define are replaced.

so if you assign a value after the instantiation is complete, it's really just an assignment, not a call to setter, so you lose the response.

The

solution is to use Vue.set, or assign the entire object.


this.collocateval = {state: 1}
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-1b382b6-2c11e.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-1b382b6-2c11e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?