Vuex의 store.js
state
전역 데이터 저장소
getters
computed처럼 state의 데이터를 계산하는 함수
countit : (state) => state.counter += 1;
mutations
state의 값을 변경
mutations: {
changeCount: (state, payload) => {
state.counters.push(payload);
}
},
actions
mutations와 유사하나 비동기방식.
보통 여기에서 조건체크를 하고 mutations 호출
actions: {
addUsers: ({commit}, payload) => {
// state의 값을 변경하기전 검사
// 변경 commit('changeData', payload);
}
}
Author And Source
이 문제에 관하여(Vuex의 store.js), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@nullpoint/Vuex저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)