vue事件处理机制


<button @click="handleAdd1()">add1</button>
<button @click="handleAdd2">add2</button>
<button @click="count++">add3</button>

不带括号可以直接传一个事件对象

 

带括号的可以传参。

<input type="text" @input="handleInput($event)" @keyup.65="handleKeyUp"/>

handleInput(ev){
  console.log(ev.target.value);
  this.mytext= ev.target.value;
}

 

还可以搞$event,加传参

<input type="text" @input="handleInput($event,param)" @keyup.65="handleKeyUp"/>

handleInput(ev,param){
  console.log(ev.target.value);
  this.mytext= ev.target.value;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM