-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
37 lines (34 loc) · 1.02 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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="./vue.js"></script>
</head>
<body>
<div id="root">
<h1>你好,{{msg}}{{number}}</h1>
<div v-html="contentHtml"></div>
<div v-text="contentText"></div>
<!-- v-on:是用于绑定一个事件,可以用@符号代替,这样更加方便 -->
<div v-on:click="handleClick"><h1>点击==>{{msg}}</h1></div>
<div @click="handleClick"><h1>点击==>{{msg}}</h1></div>
</div>
<script>
new Vue({
el:"#root",
data:{
msg: "Hello World!",
number: 123,
contentHtml: "<h2>以html格式进行展示</h2>",
contentText: "<h2>以文本格式进行展示</h2>"
},
methods:{
handleClick : function(){
this.msg = "世界和平!"
}
}
})
</script>
</body>
</html>