gpt4 book ai didi

vue.js - Vuejs(vuex)错误未知本地突变类型

转载 作者:行者123 更新时间:2023-12-01 21:58:13 24 4
gpt4 key购买 nike

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

unknown local mutation type: setRegisterEmail, global type: authentication/setRegisterEmail

试了很多方法还是不行

这是我的 register.vue:

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

这是我的 autentication.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;
},
},
};

最佳答案

您的 authentication.js 有错别字。将 mutation 替换为 mutations

关于vue.js - Vuejs(vuex)错误未知本地突变类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55119385/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com