select2.vue 632 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<template>
  <select multiple="multiple">
    <option v-for="option in options" :value="option.value" :key="option.id || option.value">{{ option.text }}</option>
  </select>
</template>

<script>
  var jQuery = require('jquery');
  require('multiple-select');

  export default {
    props: ['options', 'value', 'placeholder'],
    mounted: function() {
      jQuery(this.$el).multipleSelect({selectAll: false, filter: true, placeholder: this.placeholder, ellipsis: true});
    },
    updated: function() {
      jQuery(this.$el).multipleSelect('refresh');
    }
  }
</script>

<style>
  select {
    min-width: 300px;
  }
</style>