-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (84 loc) · 2.2 KB
/
index.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="../vue.js"> </script>
</head>
<body>
<div id="app">
显示数据: {{ message }}
</div>
<hr>
<div id="app2">
<span :title="message">hey 数据绑定</span>
</div>
<hr>
<div id="app3">
<p v-if="seen">if 语句</p>
</div>
<hr>
<div id="app4">
for循环(也可以循环对象 (value, key, index))
<ol>
<li v-for="(item, i) in items">
{{ parentMsg }}: {{ i }}:{{ item.text }}
</li>
</ol>
</div>
<hr>
<div id="app5">
事件绑定
<p>{{ message }}</p>
<button v-on:click="reverseMessage()">reverse message</button>
</div>
<hr>
<div id="app6">
双向绑定
<p>{{ message }} </p>
<input v-model="message" />
</div>
<hr>
<div id="app7">
组件化, 全局组件
<ol>
<todo-item
v-for="item in groceryList"
:todo="item"
:key="item.id"
></todo-item>
</ol>
</div>
<hr>
<div id="app8">
属性名绑定 (无效???)
<a :[attrName]="url">do something {{ attrName }}</a>
</div>
<hr>
<div id="app9">
{{ message }}
<p>computed message: {{ reverseMessage }} </p>
</div>
<hr>
<div id="app10">
<div :class="curClass" :style="curStyle">class bind</div>
</div>
<hr>
<div id="app11">
<ol>
<li v-for="item in items">
{{ item.text }}
</li>
</ol>
<button @click="sortItems">sort items</button>
</div>
<div onclick="alert(1)" style="width: 50px; height: 50px; background: red; position: relative">
<div style="width: 50px; height: 50px; background: green; position: absolute; top: 60px; ">
</div>
</div>
<script src="./index.js"></script>
<link rel="stylesheet" type="text/css" href="./index.css">
</body>
</html>