@click.native的使用

给Vue组件绑定事件,需要在事件后面加上.native,比如:<el-input @click.native.enter="login">,相当于$emit("click".fn)。
有一天突然发现使用el-button的时候是这样的:

<el-button @click="handler"></el-button>

是因为element-ui已经在el-button组件源码中给我们this.$emit('click', evt)事件了

posted @ 2020-03-18 18:39  shetoutou  阅读(2054)  评论(0编辑  收藏  举报