
설치 npm i vuex store 폴더에 관리하기 위해 store폴더, 파일 생성 store/store.js import Vue from 'vue'; import Vuex from 'vuex'; Vue.use(Vuex); const store = new Vuex.Store({ state: { //... }, getter: { //... }, mutations: { //... }, action: { //... } }) 이런 형태로 작업하면 된다. - state: 여러 컴포넌트에 공유되는 데이터 - getter: 연산된 state값을 접근하는 속성 - mutations: state값을 변경하는 이벤트 로직이나 메서드 - actions: 비동기 처리 로직을 선언하는 메서드 그리고 store 파일을 등록해줘야..
Vue
2021. 6. 17. 22:58