@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)事件了

猜你喜欢

转载自www.cnblogs.com/shemingxin/p/12519307.html
今日推荐