SOURCE

console 命令行工具 X clear

                    
>
console
new Vue({
  el:'#app',
  
  data:{
    value:'',
    value1:'',
    arguments:0
  },
  methods:{
    click:function(){
      alert('haha');
    },
    showValue:function(event){
      this.value = event.target.value;
    },
    showValue1:function(event){
      this.value1 = event.target.value;
    },
    testArguments:function(step1, step2, e){
      console.log(e);
      this.arguments += (step1 + step2);
    }
  }
})
<div id="app">
  <!--v-on:click 可以简写成 @click-->
  <button v-on:click='click'>Click to Alert</button>
  <!--当需要传参的时候,直接调用函数,并在实参后面添加‘$event’来手动传入事件对象-->
  <button v-on:click='testArguments(1,2,$event)'>Test Arguments</button><span>{{arguments}}</span>
  <p><input v-on:keyup='showValue' type="text">{{value}}</p>
  <!--可以使用按键修饰符,一些常用的按键修饰符:stop阻止冒泡,prevent阻止默认行为,还有enter\spance\各个按键对应的数字等,可链式调用-->
  <p><input v-on:keyup.enter.space.13='showValue1' type="text">{{value1}}</p>
</div>