반응형
VueStoreFront: 커스텀 모듈: 상태는 갱신되지만 컴포넌트는 갱신되지 않음
"에서 데이터를 가져오는 커스텀 모듈을 만들고 있습니다.afterRegistration
" 를 눌러 결과를 저장소에 저장합니다.
상태가 업데이트되었지만(VueDevTools에서 업데이트를 볼 수 있음) 구성 요소는 여전히 기본 상태입니다.내가 뭘 잘못하고 있지?
// afterRegistration
export function afterRegistration ({Vue, config, store, isServer}) {
store.dispatch(${KEY}/isVisible)
}
// component
export default {
name: 'Test',
components: { Fragment },
props: {
…
},
computed: {
isVisible: el => el.$store.getters['myModule/simpleTest']
}
}
당신은 반응성을 잃었어요.의 초기값을 설정합니다.simpleTest
(문맥에서 보면) 당신이 좋아하는 것에 대한 상태상의 반대입니다.Boolean
초기 상태가 아닌 경우 이 필드에 getter 또는 setter는 없습니다.
네, 비동기 로더로 디스패치를 해야 한다는 것을 알았습니다.
// afterRegistration
export function afterRegistration ({Vue, config, store, isServer}) {
AsyncDataLoader.push({
execute: ({ route, store, context }) => {
return new Promise ((resolve, reject) => {
store.dispatch(`${KEY}/getInlineTranslationConfig`)
.then(() => resolve(null))
})
}
})
이제 됐다!
언급URL : https://stackoverflow.com/questions/57025377/vuestorefront-custom-module-state-is-updated-component-not
반응형
'programing' 카테고리의 다른 글
vuex-module-decorator를 사용한nuxtServerInit (0) | 2022.07.11 |
---|---|
페이지를 새로고침하지 않으면 Vuex 상태가 반응하지 않음 (0) | 2022.07.11 |
롬복(lombok)을 사용하여 기존 객체에서 객체 만들기 (0) | 2022.07.11 |
입력 스트림을 두 번 읽습니다. (0) | 2022.07.11 |
console.log()가 브라우저에 아무것도 기록하지 않는 이유는 무엇입니까? (0) | 2022.07.11 |