data는 computed를 계산하기 전에 평가된다.
때문에 data의 값을 computed값으로 대입할 수 없는 것이다.
해결 : 굳이 이런 로직을 써야한다면, watch로 computed값이 바뀌었을때 data를 초기화해주는 방법을 활용할 수 있다.
※ data값으로 store값을 사용할 수는 있다.
참고자료
https://stackoverflow.com/questions/44318343/use-computed-property-in-data-in-vuejs
'프론트엔드 > vue' 카테고리의 다른 글
v-model 에 대해 (0) | 2023.05.12 |
---|---|
v-slot (0) | 2023.05.10 |
vue best practice (0) | 2023.05.08 |
[vue2] slot (0) | 2023.03.26 |
[vue router] a태그와 router-link의 차이 (0) | 2023.03.26 |