support button autofocus && autofocus message box confirm button

pull/730/head
baiyaaaaa 2016-10-30 16:12:16 +08:00 committed by cinwell.li
parent 01a6bd6f40
commit 2e77e5a50b
3 changed files with 7 additions and 13 deletions

View File

@ -191,4 +191,5 @@ Button 组件提供除了默认值以外的三种尺寸,可以在不同场景
| plain | 是否朴素按钮 | Boolean | true,false | false | | plain | 是否朴素按钮 | Boolean | true,false | false |
| disabled | 禁用 | boolean | true, false | false | | disabled | 禁用 | boolean | true, false | false |
| icon | 图标,已有的图标库中的图标名 | string | — | — | | icon | 图标,已有的图标库中的图标名 | string | — | — |
| autofocus | 是否默认聚焦 | boolean | — | false |
| native-type | 原生 type 属性 | string | button,submit,reset | button | | native-type | 原生 type 属性 | string | button,submit,reset | button |

View File

@ -1,6 +1,7 @@
<template> <template>
<button :disabled="disabled" class="el-button" <button :disabled="disabled" class="el-button"
@click="handleClick" @click="handleClick"
:autofocus="autofocus"
:type="nativeType" :type="nativeType"
:class="[ :class="[
type ? 'el-button--' + type : '', type ? 'el-button--' + type : '',
@ -35,18 +36,10 @@
type: String, type: String,
default: 'button' default: 'button'
}, },
loading: { loading: Boolean,
type: Boolean, disabled: Boolean,
default: false plain: Boolean,
}, autofocus: Boolean
disabled: {
type: Boolean,
default: false
},
plain: {
type: Boolean,
default: false
}
}, },
methods: { methods: {

View File

@ -16,7 +16,7 @@
</div> </div>
<div class="el-message-box__btns"> <div class="el-message-box__btns">
<el-button :class="[ cancelButtonClasses ]" v-show="showCancelButton" @click.native="handleAction('cancel')">{{ cancelButtonText }}</el-button> <el-button :class="[ cancelButtonClasses ]" v-show="showCancelButton" @click.native="handleAction('cancel')">{{ cancelButtonText }}</el-button>
<el-button :class="[ confirmButtonClasses ]" v-show="showConfirmButton" @click.native="handleAction('confirm')">{{ confirmButtonText }}</el-button> <el-button autofocus :class="[ confirmButtonClasses ]" v-show="showConfirmButton" @click.native="handleAction('confirm')">{{ confirmButtonText }}</el-button>
</div> </div>
</div> </div>
</transition> </transition>