Vue 3,未捕获类型错误:Vue.use 不是函数

Rei*_*nis 3 laravel vue.js vuejs2 vuejs3 laravel-vue

我正在尝试将 Laravel 项目的前端从 vue 2 升级到 Vue 3。在此过程中,我遇到了一个问题

未捕获的类型错误:Vue.use 不是函数

我不知道问题出在哪里,如果您有任何想法,请帮助我。谢谢。

Tho*_*mas 9

Vue.useVue3 不再支持,因为它Vue不再是全局实例。您必须将插件添加到应用程序:

const app = createApp(MyApp)
app.use(VueRouter)
Run Code Online (Sandbox Code Playgroud)

如此处所述: https: //v3-migration.vuejs.org/writing-changes/global-api.html#a-note-for-plugin-authors