v-select2-multiple-component
Select2 control with multiple select for Vue.
Dependencies libraries
V-Select2-Component is baseed on these plugins and libs(version):
- vue(>= 2.0-release)
- jQuery
- select2
- v-select2-component (the select2 component version but not support multiple select)
How to install & use
Install
// npm installnpm install v-select2-multiple-component --save
Use in component
- Import as global component (use everywhere):
// import Select2MultipleControl;Vue;// ...
- Import into a single component:
<template><div><select2-multiple-control v-model="myValue" :options="myOptions" @change="myChangeEvent($event)" @select="mySelectEvent($event)" /><h4>Value: myValue </h4></div></template><script>;// declare Select2MultipleControlcomponents: Select2MultipleControl{returnmyValue: ''myOptions: 'op1' 'op2' 'op3' // or [{id: key, text: value}, {id: key, text: value}]}method:{console;}{console}</script>
Option settings
options
:option[]
- data source for select2
option
:{id: key, text: value}
orstring
v-model
: option values that is selectedid[]
orstring[]
change
- callback when option selected change
- return value
- parmas: same with
v-model
select
- callback when option selected
- parmas:
option
({id: value, text: key, selected: ifSelected}
orstring
)
disabled
- if select is disabled
settings
- configurable settings, see Select2 options API
setting
:{ settingOption: value, settingOption: value }
Final
Special thanks to godbasin for the non-multiselect select2.
Copyright © 2018 by Seth Phat Phat Tran Minh