-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv-bind2.html
55 lines (52 loc) · 1.33 KB
/
v-bind2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>v-bind属性</title>
<script src="js/vue.js"></script>
<script>
window.onload = function () {
new Vue({
el: "#box",
data: {
a: true,
b: false,
json: {
red: false,
blue: true
},
c: {color: 'blue'},
d: {background: 'red'},
f:{
color:'blue',
backgroundColor:'gray'
}
},
methods: {}
})
}
</script>
<style>
.red {
color: red;
}
.blue {
background: blue;
}
</style>
</head>
<body>
<div id="box">
<!--class的几种显示方式-->
<strong :class="{red:true,blue:true}">okokoko</strong>
<strong :class="{red:a,blue:b}">okokoko</strong>
<strong :class="json">okokoko</strong>
<hr>
<!--Style几种显示方式-->
<strong :style="{color:'red'}"> 你好style</strong>
<strong :style="[c]"> 你好style</strong>
<strong :style="[c,d]"> 你好style</strong>
<strong :style="f"> 你好style</strong>
</div>
</body>
</html>