Vuejs (vuex) 错误未知局部突变类型

Try*_*ard 2 vue.js vuex

当我在注册页面输入内容时出现错误。错误说:

unknown local mutation type: setRegisterEmail, global type: authentication/setRegisterEmail
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法还是无法修复。

这是我的register.vue:

Import { mapState, mapMutations, mapActions } from 'vuex';
export default {
  computed: {
    ...mapState('authentication', [
      'registerEmail',
      'registerPassword',
      'registerError',
    ]),
  },
  methods: {
    ...mapMutations('authentication', [
      'setRegisterEmail',
      'setRegisterPassword',
    ]),
    ...mapActions('authentication', [
      'register',
    ]),
  },
};
Run Code Online (Sandbox Code Playgroud)

这是我的authentication.js:

export default {
    namespaced: true,
    state: {
        registerEmail: null,
        registerPassword: null,
        registerError: null,
        token: null,
    },
    mutation: {
        setToken(state, token) {
            state.token = token;
        },
        setRegisterEmail(state, email) {
            state.registerEmail = email;
        },
        setRegisterPassword(state, password) {
            state.registerPassword = password;
        },
    },
};
Run Code Online (Sandbox Code Playgroud)

Ham*_*bot 7

你的authentication.js. 替换mutationmutations