반응형
Vuex 알 수 없는 작업 유형...동작이 로딩되지 않음
알 수 없는 작업 유형에 문제가 있습니다.
store.syslog:
import Vue from 'vue'
import Vuex from 'vuex'
import { state } from './store/state'
import { mutations } from './store/mutations'
import { actions } from './store/actions'
import { getters } from './store/getters'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
export default new Vuex.Store({
actions,
mutations,
getters,
state,
plugins: [createPersistedState()]
})
actions.syslog
import { ServerAPI } from '../plugins/server-api'
import { Mutations } from './mutations'
export const Actions = {
checkAuth: 'checkAuth',
loadCustomers: 'loadCustomers'
}
export const actions = {
[Actions.checkAuth] (context, payload) {
},
[Actions.loadCustomers] ({ commit }) {
// context.state
let customers = {}
ServerAPI.getCustomers().then((response) => {
if (response.status === 200) {
response.data.forEach((customer) => {
customers[customer.id] = customer
})
commit(Mutations.assignBulkCustomers, customers)
}
}).catch((error) => {
console.log(error)
})
return Promise.resolve(customers)
}
}
App.vue
methods: {
...mapActions([
Actions.loadCustomers,
Actions.checkAuth
]),
그리고 그것을 호출한다.
this.loadCustomers()
나는 왠지 이 오류를 가지고 있다. [vuex] unknown action type: loadCustomers
디버깅 정보를 보면 액션이 로드되어 있지 않지만 getters와 mutrate는 로드되어 있는 것을 알 수 있습니다.
언급URL : https://stackoverflow.com/questions/56311497/vuex-unknown-action-type-wont-load-my-actions
반응형
'programing' 카테고리의 다른 글
| Java Map의 각 엔트리에 대해 효율적으로 반복하려면 어떻게 해야 합니까? (0) | 2022.07.29 |
|---|---|
| Java의 객체와 같은 구조 (0) | 2022.07.29 |
| 페이지를 갱신할 때 Vuex 및 VueRouter에서 글로벌 상태가 손실되지 않도록 합니다. (0) | 2022.07.28 |
| Java enum - 이름 대신 toString을 사용하는 이유 (0) | 2022.07.28 |
| JBoss의 힙 덤프에 HeapDumpOnOutOfMemoryError 매개 변수 사용 (0) | 2022.07.28 |