Nuxt Vue Multiselect Module

1.0.4 · abandoned · verified Tue Apr 21

This Nuxt.js module integrates the `vue-multiselect` component into Nuxt applications, simplifying its setup and usage. It handles the automatic global registration of the `Multiselect` component, allowing developers to use `<multiselect>` directly in their Vue templates without manual imports. `vue-multiselect` itself is a popular component for single/multiple selection, tagging, and asynchronous search capabilities, offering extensive customization through props and slots. This specific Nuxt wrapper, currently at version 1.0.4, shows its last significant activity around 2020. Given its reliance on `vue-multiselect` (which primarily supports Vue 2) and the lack of recent updates, `nuxt-vue-multiselect` is not compatible with Nuxt 3 or Vue 3 projects and should be considered abandoned for modern Nuxt development, best suited for existing Nuxt 2 applications.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to set up `nuxt-vue-multiselect` in `nuxt.config.js` and then use the `<multiselect>` component within a Vue template with options for multiple selection.

/* nuxt.config.js */
export default {
  modules: [
    'nuxt-vue-multiselect'
  ],
  // It's often necessary to manually include the CSS for vue-multiselect.
  // You can do this globally in nuxt.config.js or directly in a component.
  css: [
    'vue-multiselect/dist/vue-multiselect.min.css'
  ],
  // If targeting older browsers, you might need to transpile vue-multiselect
  build: {
    transpile: ['vue-multiselect']
  }
}

/* pages/index.vue (or any other Vue component) */
<template>
  <div>
    <h1>Select Your Favorite Frameworks</h1>
    <label for="framework-select">Choose some frameworks:</label>
    <multiselect
      id="framework-select"
      v-model="selectedFrameworks"
      :options="availableFrameworks"
      :multiple="true"
      :close-on-select="false"
      :clear-on-select="false"
      :searchable="true"
      placeholder="Pick frameworks"
      label="name"
      track-by="name"
    ></multiselect>
    <p>Currently selected: {{ selectedFrameworks.map(f => f.name).join(', ') || 'None' }}</p>
  </div>
</template>

<script lang="ts">
import Vue from 'vue'

interface FrameworkOption {
  name: string;
  code: string;
}

export default Vue.extend({
  name: 'FrameworkSelector',
  data() {
    return {
      selectedFrameworks: [] as FrameworkOption[],
      availableFrameworks: [
        { name: 'Vue.js', code: 'VUE' },
        { name: 'Nuxt.js', code: 'NUXT' },
        { name: 'React', code: 'REACT' },
        { name: 'Angular', code: 'ANGULAR' },
        { name: 'Svelte', code: 'SVELTE' },
        { name: 'Solid', code: 'SOLID' }
      ]
    }
  },
})
</script>

view raw JSON →