<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>事件</title>
<script src="vue.js"></script>
</head>
<body>
<div id="root">
<div v-text="msg"></div>
<div v-html="msg"></div>
<div v-on:click="handleClick">
<div v-text="content"></div>
</div>
<div @click="handleClick">
<div v-text="content"></div>
</div>
</div>
<script>
new Vue({
el:"#root",
data:{
msg:"<h1>hello world</h1>",
content:"點擊我"
},
methods:{
handleClick:function (){
this.content="點擊成功!";
}
}
})
</script>
</body>
</html>