diff --git a/api-generator/components/autocomplete.js b/api-generator/components/autocomplete.js index bc2468e29..f745c56f2 100644 --- a/api-generator/components/autocomplete.js +++ b/api-generator/components/autocomplete.js @@ -387,11 +387,15 @@ const AutoCompleteSlots = [ }, { name: 'content', - description: 'Custom content for the virtual scroller' + description: 'Custom content for the virtual scroller.' }, { name: 'loader', - description: 'Custom content for the virtual scroller loader items' + description: 'Custom content for the virtual scroller loader items.' + }, + { + name: 'empty', + description: 'Custom empty template when there is no data to display.' } ]; diff --git a/components/autocomplete/AutoComplete.d.ts b/components/autocomplete/AutoComplete.d.ts index 02546022f..f1c608040 100755 --- a/components/autocomplete/AutoComplete.d.ts +++ b/components/autocomplete/AutoComplete.d.ts @@ -381,6 +381,10 @@ export interface AutoCompleteSlots { */ options: any[]; }) => VNode[]; + /** + * Custom empty template when there is no data to display. + */ + empty: () => VNode[]; } export declare type AutoCompleteEmits = { diff --git a/components/autocomplete/AutoComplete.vue b/components/autocomplete/AutoComplete.vue index 8b648b225..a3ff29818 100755 --- a/components/autocomplete/AutoComplete.vue +++ b/components/autocomplete/AutoComplete.vue @@ -119,6 +119,9 @@ +
@@ -323,7 +326,7 @@ export default { watch: { suggestions() { if (this.searching) { - ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : this.hide(); + ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : !!this.$slots.empty ? this.show() : this.hide(); this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; this.searching = false; } diff --git a/pages/autocomplete/AutoCompleteDoc.vue b/pages/autocomplete/AutoCompleteDoc.vue index 7faf69f9f..f5040e542 100755 --- a/pages/autocomplete/AutoCompleteDoc.vue +++ b/pages/autocomplete/AutoCompleteDoc.vue @@ -562,6 +562,10 @@ export default {