computed mapGetters userName usergetUserName userName拿不到
There could be several reasons why you are not able to retrieve the value of 'userName' using the mapGetters method. Here are a few things you can check:
-
Make sure that the 'user' module is properly registered in your Vuex store. The module should be imported and added to the modules property of the store instance.
-
Verify that the 'getUserName' getter is defined in the 'user' module. The getter should be exported and accessible within the module.
-
Ensure that the state property 'userName' is correctly defined in the 'user' module. The state property should be reactive and contain the desired value.
-
Check that the Vuex store is properly connected to your Vue component. The store should be imported and added to the 'store' option of the Vue component.
-
Confirm that the component is properly importing the mapGetters method from the vuex module. The method should be called correctly and the getter name should match the one defined in the 'user' module.
By verifying these points, you should be able to identify and resolve the issue with accessing the 'userName' value
原文地址: https://www.cveoy.top/t/topic/ihb8 著作权归作者所有。请勿转载和采集!