Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vue-multiselect does not load CSS

I am using vue-multiselect component (b15) with vue-cli (webpack template) but the component's CSS is not loaded and the component renders wrong. Any idea?

My code:

<template>
  <div>
      <div class="select2-container select2-container-multi full-width">
        <multiselect
          class="form-control form-control-select textarea" 
          :class="{ 'has-error': showError }"
          :options="localOptions"
          :label="labelKey"
          track-by="id"
          :multiple="multiple"
          :selected="value"
          :searchable="true"
          :placeholder="placeholder" 
          :loading="loading"
          :custom-label="formatLabel"
          :disabled="disabled"
          :readonly="readonly"
          @input="updateSelected"
          @close="blur">
        </multiselect>
      </div>
  </div>
</template>

<script>
import Multiselect from 'vue-multiselect'

export default {
  mixins: [inputMixin],

  components: {
    Multiselect
  }
}
</script>

Multiselect is rendered and everything just no style is applied.

like image 319
Primoz Rome Avatar asked Sep 25 '26 03:09

Primoz Rome


1 Answers

You need to add css seperately at the end, so you file looks like that:

<template>
  <div>
      <div class="select2-container select2-container-multi full-width">
        <multiselect
          class="form-control form-control-select textarea" 
          :class="{ 'has-error': showError }"
          @input="updateSelected"
          @close="blur">
        </multiselect>
      </div>
  </div>
</template>

<script>
import Multiselect from 'vue-multiselect'

export default {
  mixins: [inputMixin],
      components: {
    Multiselect
  }
}
</script>

<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
like image 119
frost Avatar answered Sep 28 '26 21:09

frost



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!