v-on 事件绑定

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style>
#app{
text-align: center;
color: red;
}
body{
color: gray;
text-align: center;
}
</style>
<body>
<div id="app">
<!-- <button type="submit" v-on:click="change">submit{{count}}</button>-->
<button type="submit" @click="count +=1">submit{{count}}</button>
</div>
<script src="../vue.min.js"></script>
<script>
new Vue({
el:'#app',

data:{
count:0
},

methods:{
change:function(){
this.count+=1;
}
}

})
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/wxhhts/p/8081148.html