1

Trying to use vue-select in vuejs3 app I got error in console:

test.vue?2762:16 Uncaught TypeError: _App_vue__WEBPACK_IMPORTED_MODULE_2__.default.component is not a function
    at eval (test.vue?2762:16)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/test.vue?vue&type=script&lang=js (app.js:1079)
    at __webpack_require__ (app.js:854)
    at fn (app.js:151)
    at eval (test.vue?c371:1)
    at Module../src/views/test.vue?vue&type=script&lang=js (app.js:1613)
    at __webpack_require__ (app.js:854)
    at fn (app.js:151)
    at eval (test.vue?b424:1)
    at Module../src/views/test.vue (app.js:1601)

My vue file:

<template>
  <div>
    <h1>Vue Select</h1>
  
    stringVar:{{ stringVar}}
    <v-select :options="options"></v-select>
  
  </div>
</template>

<script>
  import app from './../App.vue'
  import { ref, onMounted } from 'vue'
  import vSelect from 'vue-select'
  import 'vue-select/src/scss/vue-select.scss'
  app.component('v-select', vSelect)

  export default {
    name: 'loginPage',
    components: {},

    setup () {
      let stringVar = ref('Init value')
      const options = [
        {
          code: 'A',
          label: 'Active'
        },
        {
          code: 'I',
          label: 'Inactive'
        },
        {
          code: 'N',
          label: 'New'
        }
      ]

      const testInit = async () => {
        console.log('testInit emitter::')
      }

      onMounted(testInit)

      return {
        stringVar
      }
    } // setup () {

  }
</script>

In package.json :

"vue": "^3.0.0",
"vue-select": "^3.10.8",

Have I configured vue-select in wrong way or vue-select is not for vuejs 3? Here https://github.com/sagalbot/vue-select I did not find any mentions of vuejs 3, but last source update 3 monthes ago...

Thanks!

Petro Gromovo
  • 1,755
  • 5
  • 33
  • 91

2 Answers2

1

I think the library hasn't been updated. In their package.json it says they're still dependendent on: "vue": "^2.6.10". Maybe you should open an issue on their github project?

Didi
  • 36
  • 3
  • Reading this https://github.com/sagalbot/vue-select/issues/1307 branch looks like that there were updates to make Vue 3 compatibility. Not sure it was not merged and we can not it use yet? – Petro Gromovo Nov 13 '20 at 08:46
0

It's still a beta but you can try this version yourself npm install vue-select@beta
You can find here all the changes and the roadmap https://github.com/sagalbot/vue-select/issues/1597

Ivan_OFF
  • 193
  • 7