일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- 청주시 일반계 고등학교
- 대한민국선거
- 가칭 동남고등학교
- 전동전기톱
- 인공지능
- 남자육아휴직
- 육아휴직급여
- 미지아
- 콜로라도
- 자전거
- 도로패임
- 샤오미
- 2024년 합계출산율
- 감나무전지
- 준연동형비례대표
- 싸이클
- 데이터시각화
- 저출산
- 픽업트럭
- 40대아빠육아
- 청주시 지하철
- 액티언스포츠
- 아빠육아
- 국민을 위한 국민연금은 없다
- 중고노트북
- 엔진오일
- 오프로드
- 코란도스포츠
- MTB
- 파리브레스트파리
Archives
- Today
- Total
열심히 일한 당신 떠나라
코딩 자율학습단(Vue.js 프런트엔드 개발 입문) 4일차 본문
3장 뷰 기본 문법 익히기
3.6 계산된 속성과 감시자 속성
계산된 속성(computed)은 컴포넌트에서 자주 사용하는 데이터를 캐시해 애플리케이션 성능을 향상시킨다.
<script>
export default {
data() {
return {
firstName: 'TH',
lastName: 'Lee',
};
},
computed: {
fullName() {
console.log("computed fullname");
return `성은 ${this.firstName} 이름은 ${this.lastName}`;
},
},
}
</script>
<template>
<h1>{{ firstName }}</h1>
<h1>{{ lastName }}</h1>
<h1>{{ fullName }}</h1>
<h1>{{ fullName }}</h1>
</template>
<style></style>
감시된 속성(watch)은 데이터의 변경을 감시하고, 변경이 감지될 때마다 특정 동작을 수행할 수 있게 한다.
3.7 스타일 다루기
style 속성, v-bind 디렉티브, 내부 스타일, 외부 스타일
<script>
export default {
data() {
return {
primaryColor: 'red',
primaryStyle: 'italic',
};
},
}
</script>
<template>
<h1 style="color: blue; font-style: italic">style</h1>
<h1 :style="{ color: primaryColor, fontStyle: primaryStyle }">v-bind Style</h1>
<h2>internal h2 Style</h2>
<h3>external h3 Style</h3>
</template>
<style>
@import './assets/main.css';
h2 {
color: orange;
font-style: italic;
}
</style>
'정보교육 > 프런트엔드' 카테고리의 다른 글
vue.js 프로젝트: 일정 관리가 포함된 홈페이지 만들기 (0) | 2024.06.23 |
---|---|
코딩 자율학습단(Vue.js 프런트엔드 개발 입문) 5일차 (0) | 2024.06.22 |
코딩 자율학습단(Vue.js 프런트엔드 개발 입문) 3일차 (0) | 2024.06.19 |
코딩 자율학습단(Vue.js 프런트엔드 개발 입문) 2일차 (0) | 2024.06.18 |
코딩 자율학습단(Vue.js 프런트엔드 개발 입문) 1일차 (0) | 2024.06.17 |