-
Notifications
You must be signed in to change notification settings - Fork 476
/
Copy path008-1 BindingObject.html
68 lines (60 loc) · 1.04 KB
/
008-1 BindingObject.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="vue.js"></script>
<style>
.static {
font-size: 120px;
width: 600px;
margin: 0 auto;
background-color: yellow;
height: 120px;
line-height: 120px;
text-align: center;
}
.classA {
color: #FF0000;
}
.classB {
text-decoration: underline;
}
.classC {
text-shadow: 2px 2px 4px #000000;
}
</style>
</head>
<body>
<div id="app">
<div v-bind:style="ccgo">
台湾小凡 vue.js 官网讲解</div>
</div>
<script>
var vm = new Vue({
el: '#app',
data: {
styleObject: {
color: 'red',
fontSize: '13px'
},
styleObject1: {
color: 'blue',
fontSize: '20px'
},
itemA: 100,
itemB: 2000
},
computed: {
ccgo: function() {
if (this.itemA < this.itemB) {
return this.styleObject
} else {
return this.styleObject1
}
}
}
});
</script>
</body>
</html>