Analyze the reason: this means that the method in actions cannot be read;
Troubleshooting:
Check whether there is a problem with the introduction:
1. In store/mutations.js If the exposure mode is export, you need to add {} when importing, as shown in the following code:
//export:
export {
state,mutations,getters
}
//import in store/index.js:
import {state,mutations,getters} from './mutations'
2. In store/actions.js If the exposure method is export default, you do not need to add {} when importing, as shown in the following code:
//export default:
export default {
// modify userInfo
changeUserInfo(context,obj){
context.commit('changeUserInfo',obj);
localStorage.setItem("userInfo",JSON.stringify(obj))
}
}
//import in store/index.js:
import actions from './actions'
Read More:
- [Solved] Vuex state Error: [vuex] do not mutate vuex store state outside mutation handlers.
- Can’t resolve ‘ansi-html-community’ & Cannot find module ‘is-docker (vuex-persistedstate Installed)
- [Solved] npm Install vuex Error: npm ERR! code ERESOLVE
- TypeScript error TS2345: Argument of type ‘String ‘is not assignable to parameter of type ‘string’
- request.js?b775:101 Uncaught (in promise) Error: Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Long’;
- [Solved] Front end error: Unknown custom element
- [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string. Received undefined error
- Vue Use ‘npm run dev’ Error: Error: Unknown option ‘–inline‘ [How to Solve]
- Error: input is invalid type [How to Solve]
- [Vue warn]: Invalid prop: type check failed for prop “index“. Expected String, got Undefined
- VScode vue Project Error: Property ‘xxx‘ does not exist on type ‘CombinedVueInstance<{ readyOnly…Vetur(2339)
- [Solved] Warning: To load an ES module, set “type“: “module“ in the package.json or use the .mjs extension
- [Solved] Invalid prop: type check failed for prop “modelValue“. Expected Number…
- After installing NPM, NRM LS reports an error throw new err_INVALID_ARG_TYPE(name, ‘string‘, value)
- [Solved] Invalid prop: type check failed for prop “index“. Expected String, got Undefined
- [Vue warn]: Invalid prop: type check failed for prop [How to Solve]
- Vue Error: error in mounted hook: TypeError: invalid src type
- How to Solve pinia Error in ts File
- Javascript: Simple package localStorge operation
- [Solved] QuotaExceededError the quota has been exceeded — Firefox