select2.vue 653 Bytes
Newer Older
1
<template>
2
  <select multiple="multiple" :name="name">
3
4
5
6
7
8
9
10
11
    <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 {
12
    props: ['name', 'options', 'value', 'placeholder'],
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    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>