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.
- How to Solve “Vue is not defined” Error
- [Solved] vue-roter 4 Error: Error: Invalid route component/Uncaught (in promise) Error: Invalid route component
- Javascript SecurityError: Failed to read the’localStorage’ property from’Window’: Access is denied for this document.
- Vue2.0: How to Use vue3 api to encapsulate Axios
- [Solved] QuotaExceededError the quota has been exceeded — Firefox
- Vue displays 404 and 500 interfaces according to HTTP response status
- Error: Computed property “menuList” was assigned to but it has no setter.
- Javascript: Simple package localStorge operation
- Vue3.0 error: Failed to resolve component el-form-item (el element to be unable to be displayed)
- [Solved] Vuepress Package Error: document is not defined
- [Solved] Vue3 Configuration routing error: Catch all routes (“*“) must now be defined using a param with a custom regexp.
- Localstorage sets the expiration time.
- [Solved] Vue3 Import element UI error: Uncaught TypeError: Cannot read properties of underfined…
- SwiftUI 2.0: How to Import Files into iOS Apps
- Vue Dynamic Display Picture Error 404: Not Found [How to Solve]
- Vue Error: component has been registered but not used [Two Methods to Solve]
- Vuepress build error: window is not defined [How to Solve]
- [Solved] SyntaxError: Cannot use import statement outside a module
- [Solved] Vue3 Error: Cant find variable: GlobalThis