The vue child component modifies the value of the parent component

the parent component has an array structure as follows

     data = [
             {xx:xx},
             {xx:xx}......
     ]

I passed the object in data to the child component. The child component wants to modify the value of this object. How to refresh the value of the parent component?

and according to the vue document
clipboard.png
I modify the object directly in the child component, the parent component is supposed to change, but there is no response.

ps: uses the $emit method, which can be done, but for some reason, $emit is not the best solution for me.

ask some great god to give me some advice.

Mar.16,2021

1. To modify the value of this object first must be to modify
2 in the parent component. The method to modify this object is provided in the parent component, which is passed to the child component
3 through props. Call the method passed in on props


when it needs to be modified in the subcomponent.

it is best to use $emit to change the value by passing events, otherwise it is easy to bring trouble to debug in the middle and later stages of the project.

modifying the value in the props in the child component does change directly to the value passed by the parent component. I don't know if the value passed by the subject is defined in data or where?


first of all, the seed component does less to change the state of the parent component. If the introduction of vuex is best controlled by vuex, you really need to modify it, you can refer to the above answer, and provide another idea, that is, transfer with bus, that is, mini vuex


yourself is not careful enough, and the object passed is wrong. Because props is an object, I modify it directly through child components. The state of the parent component changes accordingly.

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-1eb186a-2367.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-1eb186a-2367.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?