<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<p>{{ message }}</p>
<button type="button" @click="onClickEvent">onClickEvent</button>
<button type="button" @click="onClickAge(age)">onClickAge</button>
<button type="button" @click="onClick(age, $event)">onClick</button>
</div>
<script>
const app = new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!',
age: 12,
},
methods: {
onClickAge(age) {
console.log('onClickAge ' + age);
},
onClickEvent(event) {
console.log('onClickEvent ' + event);
},
onClick(age, event) {
console.log('onClick ' + age);
console.log('onClick ' + event);
}
},
})
</script>
</body>
</html>