programing

Nuxt.js Vuex / console.login 변환으로 미래 상태를 확인할 수 있습니까?

goodcopy 2022. 7. 28. 22:31
반응형

Nuxt.js Vuex / console.login 변환으로 미래 상태를 확인할 수 있습니까?

앱을 빌드하기 위해 Nuxt.js와 모듈 Vuex를 사용하고 있는데 질문이 있습니다.

test() 함수를 트리거할 수 있는 버튼이 있습니다.

페이지/패킷을 클릭합니다.표시하다

<button @click="test">Test</button>

methods: {
  test() {
    this.$store.commit('user/test', { value: 'after' })
  }
}

스토어/사용자.삭제

export const state = () => ({
  hello: 'before'
})

export const mutations = {
  test(state, { value }) {
    console.log(state) // <- when I trying to console.log here, the value of hello was 'after'
    state.hello = value
  }
}

제가 뭘 놓쳤나요? 아니면 그게 정상인가요?

언급URL : https://stackoverflow.com/questions/61894313/nuxt-js-vuex-the-console-log-in-mutation-can-see-the-future-state

반응형