티스토리 뷰
공통점
Reactive Data 변경 시점에 처리를 담당
차이점
Program State 변경 Logic 존재 여부
- 존재 : Watch 사용
- 미 존재 : Computed 사용
Computed는 Program state를 바꾸지 않는 Pure Function이다.
예시
computed
data() {
return {
name: "half"
}
}
computed:{
welcome() {
return "hi" + this.name
}
}
watch
data() {
return {
isLoading: false,
data1: 1,
data2: 2,
}
}
methods: {
// someProcess1, someProcess2 : change Program State
someProcess1() {
...
this.data1 = 10
...
}
someProcess2() {
...
this.data2 = 20
...
}
}
watch: {
isLoading(newVal) {
if(newVal == true) someProcess1()
else someProcess2()
}
}
'Vue.js' 카테고리의 다른 글
[vue] TypeError: Cannot read properties of null (reading 'isCE') 해결 (vue & vite 사용자) (0) | 2024.03.12 |
---|---|
[Vue] Comoponent 내 상수 관리 (0) | 2022.12.03 |
[Vue3] Child Component에 v-model 사용하기 (0) | 2022.08.30 |
[Vue] ESLint, Prettier 적용 및 VSCode 적용 (0) | 2022.08.24 |
[Vue x vite] @ path 별칭 의미 및 VSCode 설정 (0) | 2022.08.23 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- oracle 19c 설치
- postgresql 트리거
- 스파르타 코딩클럽
- rest api crud
- unmounted document.addlistener
- unplugin-auto-import
- 1종 적성검사 과태료
- 오블완
- Oracle Database 19c install
- 외래키 삭제
- vue onunmounted
- docker image 경량화
- 1종 적성검사 국가건강검진
- postgresql on update current_timestamp
- 강서 운전면허 시험장
- Oracle Database 19C 설치
- docker multi stage build
- 1종 적성검사 신체검사
- vue 타이머 해제
- 1종 적성검사
- postgresql 수정시간 자동 갱신
- express crud
- 티스토리챌린지
- unmounted composable
- unmounted setinterval
- dockerignore
- vue unmounted
- rest api 단건 다건
- rest api 조회 생성 수정 삭제
- vue 이벤트 해제
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함