2

vue-cli と typescript を使用して新しい Vue 3 をインストールしました。すべて実行中ですが、https://vue-select.org/パッケージを追加すると、ブラウザ コンソールでこのエラーが発生します

Uncaught (in promise) TypeError: this.$on is not a function
    at Proxy.created (vue-select.js?4a7a:1)
    at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:155)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?5c40:164)
    at callHook (runtime-core.esm-bundler.js?5c40:3182)
    at applyOptions (runtime-core.esm-bundler.js?5c40:3109)
    at finishComponentSetup (runtime-core.esm-bundler.js?5c40:7265)
    at setupStatefulComponent (runtime-core.esm-bundler.js?5c40:7190)
    at setupComponent (runtime-core.esm-bundler.js?5c40:7117)
    at mountComponent (runtime-core.esm-bundler.js?5c40:5115)
    at processComponent (runtime-core.esm-bundler.js?5c40:5090)

簡単な例

Home.vue
<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
    <vSelect :options="[{label: 'Canada', code: 'ca'}]"></vSelect>
  </div>
</template>

<script lang="ts">
import { Options, Vue } from 'vue-class-component';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
import vSelect from 'vue-select';

@Options({
  components: {
    HelloWorld,
    vSelect
  },
})
export default class Home extends Vue {}
</script>


4

1 に答える 1