반응형
VueNuxtNextServerInit에서 데이터를 로드하지 않습니다.
Vuex Store에서 정의합니다.nuxtServerInit()전혀 초기화되지 않습니다!
import Vuex from 'vuex'
import mod1 from './modules/mod1'
import mod2 from './modules/mod2'
const store = () => {
return new Vuex.Store({
actions: {
nuxtServerInit() {
setTimeout(() => console.log('Hello'), 10000)
}
},
modules: {
mod1,
mod2
}
})
}
export default store
내가 뭘 잘못하고 있나요?도와주세요!
전화하는 것이 확실합니까?NuxtServerInit부터store/index.js그리고 당신은 모듈 모드에 있지 않습니까?
Vuex 저장소의 모듈 모드를 사용하는 경우 기본 모듈(store/index.js에 있음)만 이 작업을 수신합니다.여기서 모듈 작업을 연결해야 합니다.
https://nuxtjs.org/guide/vuex-store/
아래 예시와 같이 시도할 수 있습니다.
actions: {
nuxtServerInit ({ commit }, { req }) {
if (req.session.user) {
commit('user', req.session.user)
}
}
}
자세한 내용은 여기를 참조하십시오.
언급URL : https://stackoverflow.com/questions/52468295/vue-nuxt-nuxtserverinit-doesnt-load-the-data
반응형
'programing' 카테고리의 다른 글
| 버전 제어에 Xcode 작업 공간 구성표 추가 (0) | 2023.06.13 |
|---|---|
| ASP.NET에 대한 전자 메일 주소 확인 (0) | 2023.06.13 |
| sql에서 열 아래의 열 합계 가져오기 (0) | 2023.06.13 |
| sqlalchemy flush()를 입력하고 ID를 입력하시겠습니까? (0) | 2023.06.13 |
| Oracle에서 고유 인덱스를 생성하면서 null을 무시하려면 어떻게 해야 합니까? (0) | 2023.06.13 |