Fixed #6773 - Provide showEmptyMessage for AutoComplete

pull/6775/head
tugcekucukoglu 2024-11-13 09:10:01 +03:00
parent 486261ec1f
commit 12f2b71122
3 changed files with 10 additions and 1 deletions

View File

@ -513,6 +513,11 @@ export interface AutoCompleteProps {
* @defaultValue No results found * @defaultValue No results found
*/ */
emptySearchMessage?: string | undefined; emptySearchMessage?: string | undefined;
/**
* When enabled, empty search message will be visible.
* @defaultValue true
*/
showEmptyMessage?: boolean | undefined;
/** /**
* Index of the element in tabbing order. * Index of the element in tabbing order.
*/ */

View File

@ -162,7 +162,7 @@
<slot name="option" :option="option" :index="getOptionIndex(i, getItemOptions)">{{ getOptionLabel(option) }}</slot> <slot name="option" :option="option" :index="getOptionIndex(i, getItemOptions)">{{ getOptionLabel(option) }}</slot>
</li> </li>
</template> </template>
<li v-if="!items || (items && items.length === 0)" :class="cx('emptyMessage')" role="option" v-bind="ptm('emptyMessage')"> <li v-if="showEmptyMessage && (!items || (items && items.length === 0))" :class="cx('emptyMessage')" role="option" v-bind="ptm('emptyMessage')">
<slot name="empty">{{ searchResultMessageText }}</slot> <slot name="empty">{{ searchResultMessageText }}</slot>
</li> </li>
</ul> </ul>

View File

@ -150,6 +150,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
showEmptyMessage: {
type: Boolean,
default: true
},
tabindex: { tabindex: {
type: Number, type: Number,
default: 0 default: 0