国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - Vue鍵盤事件為何要加上native?
女神的閨蜜愛上我
女神的閨蜜愛上我 2017-07-05 11:01:27
0
4
993

<template>

<el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px"
         class="demo-ruleForm login-container" >
    <h3 class="title">系統(tǒng)登錄</h3>
    <el-form-item prop="account">
        <el-input type="text" v-model="ruleForm2.account" auto-complete="off" placeholder="賬號"></el-input>
    </el-form-item>
    <el-form-item prop="password">
        <el-input type="password" v-model="ruleForm2.password" auto-complete="off" placeholder="密碼" @keyup.enter.native="handleSubmit2"></el-input>
    </el-form-item>

    <el-form-item style="width:100%;">
        <el-button type="primary" style="width:100%;"  @click.native.prevent="handleSubmit2" :loading="logining" >登錄
        </el-button>
    </el-form-item>
</el-form>

</template>

@keyup.enter這里必須加上 .native 才能生效.

女神的閨蜜愛上我
女神的閨蜜愛上我

全部回復(fù)(4)
Peter_Zhu

因?yàn)槟鉆keyup.enter是寫在一個封裝好的組件上
如果你寫在一個input上就不需要.native
至于為什么,請參考vue文檔

三叔

給組件綁定原生事件采用的方法

阿神

@ 這個東西實(shí)際上是 v-on 的簡寫,而 v-on 則是對 Vue 的事件體系封裝后的 API 接口。

Vue 的官方文檔中指出了,Vue 使用的是一套自己的事件傳遞機(jī)制,如 @click 等事件是經(jīng)過 Vue 封裝的。因此,在一些實(shí)際上處理 DOM 原生事件的場合才需要添加額外的標(biāo)識符。

Peter_Zhu

沉了沉了....

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板