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:
- [Vuejs]-How to I make the select drop down show the currently selected value in Vue?
- [Vuejs]-Vue.js 3 โ watching props in child component does not work if props comes with a member of array in parent component
Source:stackexchange.com