+ <span class=hljs-selector-class>.suggest-item</span></code></pre><hr> <h3 id=api-definitions><a class=header-link href=#api-definitions></a>API definitions</h3> <h4 id=props><a class=header-link href=#props></a>Props</h4> <table> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>controls</code> <sup><a href=https://github.com/KazanExpress/vue-simple-suggest/releases/tag/v1.2.0>v1.2.0</a></sup></td> <td>Object</td> <td>See <a href=#default-controls>default controls</a></td> <td>Determines the keyboard shortcuts in key-codes (for browser-compatibility purposes). Arrays provide the ability to assign multiple keys to one action. Consists of 5 array fields: <code>selectionUp</code>, <code>selectionDown</code>, <code>select</code>, <code>hideList</code> and <code>autocomplete</code>, all of which are optional.</td> </tr> <tr> <td><code>max-suggestions</code></td> <td>Number</td> <td><code>10</code></td> <td>The maximum amount of suggestions to display. Set to 0 for infinite suggestions.</td> </tr> <tr> <td><code>min-length</code></td> <td>Number</td> <td><code>3</code></td> <td>The minimum amount of symbols in input to trigger suggestion list. <code>vue-simple-suggest</code> starts behaving as a dropdown menu, if the value is 0.</td> </tr> <tr> <td><code>display-attribute</code></td> <td>String</td> <td><code>'title'</code></td> <td>The property in a suggestion object to display in a list. Supports dotted paths.</td> </tr> <tr> <td><code>value-attribute</code></td> <td>String</td> <td><code>'id'</code></td> <td>The property in a suggestion object to use as a unique key. Supports dotted paths.</td> </tr> <tr> <td><code>list</code></td> <td>Funciton or Array</td> <td><code>() => []</code></td> <td>The array provider function, must accept a query as its only argument. Can return an array or a promise. Can be async. The component behaves as a simple input without this function.</td> </tr> <tr> <td><code>debounce</code></td> <td>Number</td> <td><code>0</code></td> <td>Determines the <code>list</code> debounce (a time between the input event and a function execution).</td> </tr> <tr> <td><code>destyled</code></td> <td>Boolean</td> <td><code>false</code></td> <td>Whether to cancel the default styling of input and suggestions list.</td> </tr> <tr> <td><code>remove-list</code></td> <td>Boolean</td> <td><code>false</code></td> <td>If true - the suggestion list will be always hidden.</td> </tr> <tr> <td><code>filter-by-query</code></td> <td>Boolean</td> <td><code>false</code></td> <td>Whether to filter the resulting suggestions by input's text query (make it a search component).</td> </tr> <tr> <td><code>filter</code></td> <td>Function</td> <td>-</td> <td>A custom function for filtering the suggestion results that accepts a single item and a query to filter by as its 2 arguments. Used only if <code>filter-by-query</code> is set to <code>true</code>.</td> </tr> <tr> <td><code>mode</code> <sup><a href=https://github.com/KazanExpress/vue-simple-suggest/releases/tag/v1.4.0>v1.4.0</a></sup></td> <td>String</td> <td><code>'input'</code></td> <td>The <code>v-model</code> event. Determines the event, that triggers <code>v-model</code>. Can be one of <code>'input'</code> (<code>v-model</code> binds a displayed property) or <code>'select'</code> (<code>v-model</code> binds a selected item).</td> </tr> <tr> <td><code>type</code>, <code>value</code>, <code>pattern</code>, etc...</td> <td></td> <td></td> <td>All of the HTML5 input attributes with their respected default values.</td> </tr> </tbody> </table> <h5 id=mode><a class=header-link href=#mode></a>mode</h5> <blockquote> <p>New in <a href=https://github.com/KazanExpress/vue-simple-suggest/releases/tag/v1.4.0>v1.4.0</a></p> </blockquote> <p>Determines the event, that triggers <code>v-model</code>. Can be one of <code>'input'</code> (default) or <code>'select'</code>.</p> <p>For example, if <code>'input'</code> is chosen - then v-model will update the value each time an <a href=#emitted-events><code>input</code></a> event is fired, setting the input's string.</p> <p>Same is for <code>'select'</code> - v-model changes only when something is selected from the list, setting the selected value (string, object or whatever) to its argument.</p> <p>A proper use-case for it being when one wants to use the component only for selection binding and custom input for text binding:</p> <pre class=hljs><code><span class=hljs-tag><<span class=hljs-name>vue-simple-suggest</span> <span class=hljs-attr>v-model</span>=<span class=hljs-string>"selected"</span> <span class=hljs-attr>mode</span>=<span class=hljs-string>"select"</span>></span>
0 commit comments