<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js"></script>
</head>
<style type="text/css">
button{
font-size: 20px;
}
</style>
<body>
<div id="app">
<button v-on:click="showsome">click me</button>
</div>
</body>
<script type="text/javascript">
new Vue({
el : "#app",
methods : {
showsome : function (e) {
// body...
console.log('show some');
console.log(e);
}
}
})
</script>
</html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js"></script>
</head>
<style type="text/css">
button{
font-size: 20px;
}
</style>
<body>
<div id="app">
<button v-on:click="showsome">click me</button>
</div>
//showsome 写成函数时 vue会自动注入一个参数
//如果写成函数的执行模式 那么需要手动注入事件对象 showsome($event)
</body>
<script type="text/javascript">
new Vue({
el : "#app",
methods : {
showsome : function (e) {
// body...
console.log('show some');
console.log(e);
}
}
})
</script>
</html>