programing

Vuejs(vuex) 오류 알 수 없는 로컬 변환 유형

coolbiz 2022. 7. 2. 21:13
반응형

Vuejs(vuex) 오류 알 수 없는 로컬 변환 유형

등록 페이지에서 입력을 입력할 때 오류가 발생합니다.오류는 다음과 같습니다.

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

여러 가지 방법을 써봤지만 아직도 고쳐지지 않아요.

여기 제 명부가 있습니다.vue:

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

여기 제 동의서가 있습니다.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

Vuex Advanced Application Structure를 사용하고 있는데 이 문제에 직면했습니다.이 문제는 cart/setCartData 등의 모듈 폴더 후 돌연변이의 완전한 디렉토리를 정의함으로써 해결되었습니다.

this.$store.commit('cart/setCartData', payload);

VuexSite 이미지를 첨부하여 고급 애플리케이션 구조를 보다 자세히 설명합니다.

언급URL : https://stackoverflow.com/questions/55119385/vuejs-vuex-error-unknown-local-mutation-type

반응형