[Vuejs]-Select2 in Vue.js is not defined

3πŸ‘

I also recommend other amazing Vue component Select2.

But if you cannot convince your boss that you will get the model updated in the vue system easy and you hace to spend a lot of time to develop, here are some ideas to try:

Delete jquery.js, and change Select2.vue to add require('select2') to select2.vue:

<script>
  import jQuery from 'jquery';
  window.jQuery = window.$ = jQuery;
  require('select2');
 ...

then, in your parent component use import with relative paths:

import Select2 from "../stangeComponents/Select2.vue";

I suppose you copy all from the Wrapper Component Example from Vue docs and everything should work…

Hope it helps πŸ™‚

πŸ‘€Juanmabs22

Leave a comment