vue获取v-on绑定事件的触发对象

<span @click="fn" id="foo">xxx</span>
fn(e){
    console.log(e);//展开查看e.currentTarget为null e.target有值
    console.log(e.currentTarget.id);//foo        
}

因为等你展开 log 出来的事件对象的时候时候它已经冒泡完毕了,自然就没有 currentTarget 了。

原文地址:https://www.cnblogs.com/yanyiyi/p/6758821.html