Skip to content

Commit

Permalink
🎨 实例中的数据,事件和方法
Browse files Browse the repository at this point in the history
  • Loading branch information
yongyu committed Sep 27, 2018
1 parent 4ec7717 commit 441a34b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@
<script src="vue.js"></script>
</head>
<body>
<!--挂载点,模板,实例之间的关系-->
<div id="root"></div>

<div id="root">
<h1 v-text="content" @click="handleClick"></h1>
<div v-html="html"></div>
</div>

<script>
new Vue({
el: "#root",
template: "<h1>hello {{msg}}</h1>>",
data: {
msg: "world"
content: "hello",
html: "<h1>Vue</h1>"
},
methods: {
handleClick: function () {
this.content = "world"
}
}
})
</script>
Expand Down

0 comments on commit 441a34b

Please sign in to comment.