vue-suggestion is a Vue 2 component library designed to provide a flexible and customizable suggestion list input, commonly known as an autocomplete field. It simplifies the process of displaying a filtered list of items to users as they type, abstracting away the UI logic for suggestion display and selection. The current stable version is 2.1.0. Releases appear to follow an ad-hoc cadence, with significant rewrites occurring in major versions like v2.0.0. Its key differentiators include support for customizable item templates using Vue components, allowing developers to define exactly how each suggestion in the list is rendered. It also provides a clear API for handling input changes and item selections through events and props.
npm install vue-suggestionVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up `vue-suggestion` with global plugin registration, local data filtering, a custom label function, and a custom item template. It shows how to handle input changes and item selections to update the component's state.
Refer to the official documentation for v2.0.0+ to understand the new API and prop structure. Migrate prop usage from individual props to the new organized `inputOptions` and `suggestionOptions` objects.
Update build configurations if they were tightly coupled to the previous build system. For most users, this change will be transparent.
For Vue 3 projects, consider using a Vue 3 native autocomplete component or migrating with `@vue/compat`. This library is not officially Vue 3 compatible out of the box.
Implement custom CSS for the `.vue-suggestion` and its child classes (`.vs__list`, `.vs__list-item`, `.vs__item-active`) to match your application's design system. Refer to the provided CSS examples in the documentation.
Ensure that the `inputChange` method (or similar handler for the `@changed` event) correctly filters the `items` data property, or fetches new data, based on the provided `text` argument.
To register globally: `import VueSuggestion from 'vue-suggestion'; Vue.use(VueSuggestion);`. To register locally: `import { VueSuggestion } from 'vue-suggestion'; export default { components: { VueSuggestion } };`Verify that the `items` array elements have the properties expected by `setLabel` and your `itemTemplate`. Adjust `setLabel` and `itemTemplate` to match the actual data structure of your `items`.
Ensure that within your `@changed` event handler, `this.items` is actively updated with the filtered results based on the input `text`. Double-check your filtering logic or data fetching mechanism.
No dependency data recorded yet.