-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature requests] add more slots #99
Comments
Yea I use the header (or footer will work) slots in one of my apps at work to show "no results". This enhanced behavior of e.g. <vue-autosuggest
:should-render-suggestions="(size, loading) => size >= 0 && !loading" (To be documented) Default:
|
@darrenjennings PS |
I like the before/after naming convention. With 2.0, I want to break as many things as make sense, because I don't want to ever have to release 3.0 😅, unless Vue itself gives me more tools to make it better in the future. What do you think about |
All slots in <!-- WARNING PSEUDO CODE, NOT RUNNING CODE OR REAL CLASS NAMES -->
<vue-autosuggest>
<slot name="before-input"/>
<input />
<slot name="after-input"/>
<div class="container">
<div class="results">
<slot name="before-suggestions" />
<ul class="suggestions">
<slot name="before-section-<section.name>" />
<li><slot name="default" /></li>
<slot name="after-section-{section.name}" />
<slot name="after-section-default" />
</ul>
</div>
<slot name="after-suggestions" />
</div>
</vue-autosuggest> |
It's a common practice to show a message like "no match", or "type more than x characters", especially when the results are loaded via AJAX. Currently, I use a workaround that is not very elegant and also doesn't produce a semanticcally correct HTML.
I store single-element arrays with boolean indicators in the
suggestions
arrayAnd I use the slot to render, either the results or the messages, depending on the indicators:
It works, but showing messages as list items isn't semantiacly correct (especially when
aria-
elements indicate that they are results, not messages).So it would be perfect if there was an additional slot outside the
autosuggest__results-container
element - or even 2: one before and one after.I know that there are
header
andfooter
slots but they show up inside the container, and also don't show up when the results list is empty. So they have a different purpose, I guess.The text was updated successfully, but these errors were encountered: