inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

닉네임_한글 가능님의 게시글

닉네임_한글 가능 닉네임_한글 가능

@lachesisxj7405

수강평 작성수
-
평균평점
-

게시글 2

질문&답변

TodoList.vue에서 삭제 처리를 위한 emit이 작동하지 않습니다.

그런데 프로그램 수정 후 아래와 같은 warn이 뜨면서 기존에 등록해놓았던 localStorage에 있는 데이터가 뜨지 않는데 이유가 뭔가요? [Vue warn]: Failed to resolve directive: blind at onRemoveItem=fn > at

좋아요수
1
댓글수
2
조회수
582

질문&답변

TodoList.vue에서 삭제 처리를 위한 emit이 작동하지 않습니다.

자답입니다. methods 부분에서 addOneItem 이후 괄호를 종료해버려서 methods내에서 찾을 수 없었네요. methods 들을 다 감싼 후 실행하니 동작합니다. methods:{ addOneItem: function(todoItem){ console.log("addOneItem:[" + todoItem + "]"); var obj = { completed : false, item: todoItem }; // console.log(this.newTodoItem); //저장하는 로직 localStorage.setItem(todoItem,JSON.stringify(obj)); this.todoItems.push(obj); } , removeOneItem: function(todoItem){ // console.log("removeOneItem app remove items:[" + index + "]:" + todoItem.item); console.log("removeOneItem app remove items:[:" + todoItem.item); localStorage.removeItem(todoItem.item); // this.todoItems.splice(index, 1); } }

좋아요수
1
댓글수
2
조회수
582