The problem of real-time changes in vuex state rendering to view

The state value of

vuex has changed, but that of the view has not changed

store

js code, written in

of the parent component
this.$store.commit("userNameChange","");

html Code

<P>{{$store.state.userName}}</P>

cannot be changed in real time even with computed . this.$store.commit has been tested in child components and parent components, but the results are not satisfactory. I don"t know if there is anything wrong with the code. Basically, it cannot be changed in real time across components, especially between two different sibling components. I want to know what way to realize real-time change of state values across components.

May.09,2022

vuex is supposed to manage the sharing status of multiple components . The subject looks to see if there is something wrong with the code, but the ones posted above cannot tell what is wrong. You can refer to this simplest example: https://jsfiddle.net/edx6gyp5/2/
implements real-time changes to the parent component regardless of the child component.


reply upstairs: your example was tried before, not even in the project. Later, you built a new project and rewrote it again. The code of store is the same as before, but it is OK, very depressed, and then delete and rewrite the store of the original project. Unexpectedly, it is OK, even more depressed, then withdraw the code, rewrite line by line, and find that it is

. In the problem of

these two lines, the rewriting code is successful without changing a single symbol. It's amazing.

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