After created, commit changes the state value, but can not get the first state value of the change.

requirements description

The directory structure of the

Header and Management components is shown below. There is a select element in the Header.vue file, and the value of select is obtained dynamically from the background. After getting the projectList, change the commit (projectId) to vuex, to change the default state.selectedProjectInfo.projectId value in the vuex, and then the Management.vue file gets the first projectId. that has just been loaded. As the selection of the select drop-down list continues to change to get the corresponding projectId

problem description

the commit sent to vuex after the hook function created brings the first projectId to vuex, but the Management file still gets the initial value of state.selectedProjectInfo.projectId set by vuex. After Header triggers the change event, Management can get the correct corresponding projectId.

to sum up: the sibling component Management file cannot correctly get the first changed state value of the Header component!

directory structure

  

						
Mar.31,2021

the value of the asynchronous request is obtained after the Management created, so it will appear as the console output 0

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