반응형
Vuex에서 알 수 없는 돌연변이 유형 us
요소
computed: {
score () {
this.$store.commit('geolocation');
console.log(this.$store.getters.lat);
}
}
store.displaces를 설정합니다.
export default {
state: {
lat:'ok',
},
getters:{
cordinate(state){
return state.lat
}
},
mutations: {
geolocation(state){
state.lat
}
},
actions: {
}
}
App.js
import StoreData from'./store.js';
Vue.use(Vuex);
const store = new Vuex.Store({StoreData});
new Vue({
el: '#app',
data: {},
router: router,
store,
})
vuex의 신기능.vuex 에서 값을 가져오려고 했지만 다음 오류가 계속 발생했습니다. [vuex] 알 수 없는 변환 유형.내가 뭘 빼놓았나요?
다음과 같이 상태 속성에 값을 할당해야 합니다.
computed: {
score () {
this.$store.commit('geolocation',78);
console.log(this.$store.getters.lat);
}
}
mutations: {
geolocation(state,newLat){
state.lat=newLat;
}
}
Vuex 스토어를 사용하는 경우mutations
그리고.actions
내부 메서드와 내부 게터 계산 속성입니다.
문제의 원인
고객님의 고객명
main.js
그랬어야 했는데const store = new Vuex.Store(StoreData);
제거하지 않고{}
주위에StoreData
언급URL : https://stackoverflow.com/questions/54595332/unknow-mutation-type-usin-vuex
반응형
'sourcecode' 카테고리의 다른 글
Java Array List 복사 (0) | 2022.08.16 |
---|---|
Windows 의 C 에 디렉토리가 존재하는지 어떤지를 확인하려면 어떻게 해야 합니까? (0) | 2022.08.16 |
vue-test-utils 설정 typeError: 문자열에 속성 '_Ctor'를 생성할 수 없습니다. (0) | 2022.08.16 |
'XMLHttpRequest has blocked by CORS policy' 수정 방법 리다이렉트에서는 1개의 루트만 사용할 수 없습니다. (0) | 2022.08.16 |
C 문자열이 비어 있는지 확인하는 방법 (0) | 2022.08.16 |