requirements description
The directory structure of theHeader 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