Autocomplete: add hide-loading (#11260)

pull/11265/head
杨奕 2018-05-21 17:27:42 +08:00 committed by GitHub
parent 54eeb5ced3
commit 38a13de337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 7 deletions

View File

@ -711,6 +711,7 @@ Attribute | Description | Type | Options | Default
| label | label text | string | — | — | | label | label text | string | — | — |
| prefix-icon | prefix icon class | string | — | — | | prefix-icon | prefix icon class | string | — | — |
| suffix-icon | suffix icon class | string | — | — | | suffix-icon | suffix icon class | string | — | — |
| hide-loading | whether to hide the loading icon in remote search | boolean | — | false |
### Autocomplete Slots ### Autocomplete Slots

View File

@ -688,6 +688,9 @@ Atributo | Descripción | Tipo | Opciones | Por defecto
| name | igual que `name` en el input nativo | string | — | — | | name | igual que `name` en el input nativo | string | — | — |
| select-when-unmatched | si se emite un evento `select` al pulsar enter cuando no hay coincidencia de Autocomplete | boolean | — | false | | select-when-unmatched | si se emite un evento `select` al pulsar enter cuando no hay coincidencia de Autocomplete | boolean | — | false |
| label | texto de la etiqueta | string | — | — | | label | texto de la etiqueta | string | — | — |
| prefix-icon | prefix icon class | string | — | — |
| suffix-icon | suffix icon class | string | — | — |
| hide-loading | whether to hide the loading icon in remote search | boolean | — | false |
### Autocomplete Slots ### Autocomplete Slots

View File

@ -863,6 +863,7 @@ export default {
| label | 输入框关联的label文字 | string | — | — | | label | 输入框关联的label文字 | string | — | — |
| prefix-icon | 输入框头部图标 | string | — | — | | prefix-icon | 输入框头部图标 | string | — | — |
| suffix-icon | 输入框尾部图标 | string | — | — | | suffix-icon | 输入框尾部图标 | string | — | — |
| hide-loading | 是否隐藏远程加载时的加载图标 | boolean | — | false |
### Autocomplete Slots ### Autocomplete Slots
| name | 说明 | | name | 说明 |

View File

@ -3,16 +3,14 @@
<div <div
v-show="showPopper" v-show="showPopper"
class="el-autocomplete-suggestion el-popper" class="el-autocomplete-suggestion el-popper"
:class="{ 'is-loading': parent.loading }" :class="{ 'is-loading': !parent.hideLoading && parent.loading }"
:style="{ width: dropdownWidth }" :style="{ width: dropdownWidth }"
role="region" role="region">
>
<el-scrollbar <el-scrollbar
tag="ul" tag="ul"
wrap-class="el-autocomplete-suggestion__wrap" wrap-class="el-autocomplete-suggestion__wrap"
view-class="el-autocomplete-suggestion__list" view-class="el-autocomplete-suggestion__list">
> <li v-if="!parent.hideLoading && parent.loading"><i class="el-icon-loading"></i></li>
<li v-if="parent.loading"><i class="el-icon-loading"></i></li>
<slot v-else> <slot v-else>
</slot> </slot>
</el-scrollbar> </el-scrollbar>

View File

@ -114,7 +114,8 @@
placement: { placement: {
type: String, type: String,
default: 'bottom-start' default: 'bottom-start'
} },
hideLoading: Boolean
}, },
data() { data() {
return { return {

View File

@ -56,6 +56,18 @@ export declare class ElAutocomplete extends ElementUIComponent {
/** Whether show suggestions when input focus */ /** Whether show suggestions when input focus */
triggerOnFocus: boolean triggerOnFocus: boolean
/** Whether to emit a `select` event on enter when there is no autocomplete match */
selectWhenUnmatched: boolean
/** Prefix icon class */
prefixIcon: string
/** Suffix icon class */
suffixIcon: string
/** Whether to hide the loading icon in remote search */
hideLoading: boolean
/** /**
* Focus the Input component * Focus the Input component
*/ */