Skip to content

Typeahead no-results slot #222

@kyleweishaupt

Description

@kyleweishaupt

I was wondering if there is any way to display a "No results" message on the Typeahead when the async function completes and zero items are returned. I can't seem to figure out a way to implement this. Any help would be greatly appreciated. If possible, adding a separate slot for 'empty' results would be excellent.

Thank you for a great package as well!

Version & browser

UIV - 0.24.0
Chrome - Version 67.0.3396.87 (Official Build) (64-bit)

Which component

Typeahead

Steps to reproduce the problem

Set up the typeahead with an async function to return the results.

<template slot="item" slot-scope="props">
    <b-dropdown-item @click="selectedItem(item)" v-if="props.items.length > 0" v-for="(item, index) in props.items">
        Item...
    </b-dropdown-item>
    <b-dropdown-item v-else>
        No results
    </b-dropdown>
</template>

Reproduce link

N/A

Expected behavior

Display "No results" when the length of items array is zero.

Actual behavior

Nothing is displayed at all.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions