html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<input type="button" value="click" v-on:click="doIt">
<input type="button" value="简写click" @click="doIt">
<span @click="changeName" v-text="name"></span>
<h2>{{ name }}</h2>
</div>
<script src="vue.js"></script>
<script>
var app = new Vue({
el: "#app",
methods: {
doIt: function () {
alert(123);
},
changeName: function () {
// console.log(this.name);
this.name += 'nb';
}
},
data: {
name: "ajupyter",
}
})
</script>
</body>
</html>