首页 > 其他 > 详细

vue 绑定事件如何传递参数的同时拿到事件对象

时间:2020-07-21 12:22:47      阅读:392      评论:0      收藏:0      [点我收藏+]

html:

 <div
    v-for="item in chatList"
    :class="item.toUserType?‘patient‘:‘doctor‘"
    @touchstart.stop="gtouchstart($event,item.msgId,item)"
    @touchmove.stop="gtouchmove()"
    @touchend.stop="gtouchend(item)"
>
</div>
 
js:
    gtouchstart($even, msgId, item) {
      //  if ($even.preventDefault) $even.preventDefault();
      //  else $even.returnValue = false;

      console.log($even, "e事件",item);
      this.timer4 = setTimeout(() => {
        this.longPress($even, msgId, item.toUserType, item);
      }, 1000);
    },
就能够获取到事件的$event事件源+元素

vue 绑定事件如何传递参数的同时拿到事件对象

原文:https://www.cnblogs.com/jackal1234/p/13352613.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!