VUE computed

VUE computed

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>08_vue_computed</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
<div id="app">
<h3>대문자로 변환시키는 과정을 구현</h3>
<p>원본 문장: "{{originalMsg}}"</p>
<p>대문자로 문장을 변경: "{{funcUpperCaseMsg}}"</p>
</div>
<script>
new Vue({
el : "#app",
data : {
originalMsg: "have a good day"
},
computed : {
funcUpperCaseMsg:function() {
console.log(this); // this는 인스턴스 객체를 가리킨다.
return this.originalMsg.toUpperCase();
}
}
})
</script>
</body>
</html>

REFERENCE
뷰(Vue.js) 프로그래밍 과정 _ 하이미디어 아카데미

  • © 2020-2025 404 Not Found
  • Powered by Hexo Theme Ayer