<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="../js/vue.js"></script>
</head>
<body>
<div id="btn">
<!-- 点击事件触发单个js表达式 -->
<button v-on:click="count+=1" >点击</button>
<p>点击次数{{count}}</p>
<!-- 无参函数 -->
<button v-on:click="submit">提交</button>
<!-- 传参函数 -->
<button v-on:click="transform(‘abc‘,$event)">传值</button>
<!-- 绑定双击事件 -->
<button v-on:dblclick="run">双击</button>
</div>
<script>
var vm=new Vue({
el:‘#btn‘,
data:{
count:0
},
methods:{
submit: function(){
alert(this.count);
},
transform:function(str,s){
console.log(s);
alert(str)
},
run:function(){
alert("双击");
}
}
});
</script>
</body>
</html>