<! DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Common instructions: V-ON</title>
<! $event -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
window.onload = function () {
let vm = new Vue({
el: '#app'.data: { // Store data
arr: [12.34.45.23.5]},methods: { // Storage method
show: function () {
console.log('show method');
},
add(e) {
console.log(this); //this represents the current Vue instance
console.log(this === vm); //true
this.arr.push(Awesome!); // Use this to access members in the current instance
console.log(this.arr)
this.show();
console.log(e.target.innerHTML); / / the DOM object}}}); }</script>
</head>
<body>
<div id="app">
<! --vue click event -->
<button v-on:click="show">Am I</button>
<! - short - >
<button @click="show">Short point I</button>
<button @mouseover="show">The mouse after</button>
<button @dblclick="show">Double click on the</button>
<button @click="add">Adds elements to an array</button>
</div>
</body>
</html>
Copy the code