Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TodoItem 더블 클릭 이벤트 emit 처리 #1

Closed
rxjw95 opened this issue Sep 19, 2021 · 1 comment
Closed

TodoItem 더블 클릭 이벤트 emit 처리 #1

rxjw95 opened this issue Sep 19, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rxjw95
Copy link
Owner

rxjw95 commented Sep 19, 2021

더블 클릭시 상태값을 변경해서 input 태그로 렌더링했는데, 이렇게 되면 각 Item들이 중복해서 input 으로 렌더링된다.

그렇기 때문에 더블 클릭시 상위 컴포넌트로 emit하는 것이 좋을 것 같다.

@rxjw95 rxjw95 added the bug Something isn't working label Sep 19, 2021
@rxjw95 rxjw95 self-assigned this Sep 19, 2021
@rxjw95
Copy link
Owner Author

rxjw95 commented Sep 20, 2021

부모 컴포넌트에서 변경될 투두의 id를 state로 저장한다.
doubleClick 이벤트가 발생하면 해당 todo id를 변경될 todo 값에 저장한다.
v-for 순회하면서 props로 변경될 todo id를 전달하고 TodoItem 컴포넌트에서 id를 비교해서 조건부 렌더링 수행

@rxjw95 rxjw95 closed this as completed Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant