vue中@click.native.prevent说明
元素中绑定了这个事件<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button>1、在封装好的组件上使用,所以要加上.native才能click。2、prevent是用
·
元素中绑定了这个事件
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">登录</el-button>
1、在封装好的组件上使用,所以要加上.native才能click。
2、prevent是用来阻止默认的事件。就相当于…event.preventDefault(),父组件想在子组件上监听自己的click的话,需要加上native修饰符。
更多推荐



所有评论(0)