[Vue] Vuex ( state, getter, mapGetters, mapstate)
1)state: component의 데이터 역할. ex) 모든 유저의 수를 불러 오고 싶을때 All Users({{$store.state.allUsers.length}}) 2)getter: component의 computed 역할. 코드를 줄여서 작성 가능하다. computed와 다른점. state를 쓸거라고 ()안에 넣어야한다. store.js getters: { //computed allUsersCount: function(state) { return state.allUsers.length } }, Allusers.vue All Users({{$store.getters.countOfSeoul}}) 아래와 같이 store를 통해 store.js의 긴 코드들을 불러올수 있다. store.js getter..
2022.11.02