inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

달세이님의 게시글

달세이 달세이

@kikii

수강평 작성수
7
평균평점
5.0

게시글 3

질문&답변

스토어 모듈화 시 ...mapState

저는 todoApp.js 모듈에 있는 headerText를 전달해주는 getters 함수를 하나 만들어서 전달하는 방식으로 해결했어요! storedTodoItems() 로 todoItems를 전달해서 리스트를 뿌려준 것처럼요. // todoApp.js const state = { headerText: 'My TODO', todoList: storage.fetch(), }; const getters = { getHeaderText(state) { return state.headerText; }, storedTodoItems(state) { return state.todoList; }, }; // TodoHeader.vue {{ this.headerText }} import { mapGetters } from 'vuex'; export default { computed: { ...mapGetters({ headerText: 'getHeaderText', }), }, };

좋아요수
4
댓글수
4
조회수
956