mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-28 08:53:57 +00:00
8a28eb1790
This reverts merge request !5
34 lines
917 B
Vue
34 lines
917 B
Vue
<template>
|
|
<select></select>
|
|
</template>
|
|
<script>
|
|
import Select2 from 'select2';
|
|
|
|
export default {
|
|
props: ['options', 'value'],
|
|
mounted(){
|
|
var vm = this;
|
|
$(this.$el)
|
|
.select2({data: this.options})
|
|
.val(this.value)
|
|
.trigger('change')
|
|
.on('change', function(){
|
|
vm.$emit('input', this.value);
|
|
});
|
|
},
|
|
watch: {
|
|
value: function(value){
|
|
$(this.$el).val(value).trigger('change');
|
|
this.$emit('selectChange');
|
|
},
|
|
options: function(options){
|
|
$(this.$el).select2({ data: options });
|
|
$(this.$el).val(this.value).trigger('change');
|
|
}
|
|
},
|
|
destroyed: function(){
|
|
$(this.$el).off().select2('destroy')
|
|
}
|
|
}
|
|
</script>
|