[Vuejs]-Failed to resolve component: ejs-multiselect with VueJs, import error

0๐Ÿ‘

I have just added all the relevant code. onSelect method will help to push your data to selectedSports. selectedSports will have your selected values.

Template Code: Put it in your template under some div

        <ejs-multiselect
              id="multiselect"
              :dataSource="sportsData"
              :select="onSelect"
        ></ejs-multiselect>

Script Code: Put it in your script

import { MultiSelectComponent  } from "@syncfusion/ej2-vue-dropdowns";

// add ejs-multiselect where you have defined your components
export default defineComponent({
    // removed extra code 
    components: {
        "ejs-multiselect": MultiSelectComponent    
    },
    data() {
      return {
        sportsData: [
           "Cricket",
           "Badminton",
           "Golf",
           "Boxing",
        ],
        selectedSports: []
      }
    },
    methods: {
       onSelect(event) {
           this.selectedSports.push(event.itemData)
       }
    }
})

It will be shown like this:

enter image description here

Leave a comment