简体   繁体   中英

Vue 3, Uncaught TypeError: Vue.use is not a function

I am trying to upgrade the Laravel project's frontend into Vue 3 from vue 2. During the process, I faced one issue

Uncaught TypeError: Vue.use is not a function

I don't know what the problem is, please help me if you have any ideas. Thanks.

Vue.use is no longer supported in Vue3 as Vue is no longer a global instance. You have to add the plugins to the app:

const app = createApp(MyApp)
app.use(VueRouter)

As described here: https://v3-migration.vuejs.org/breaking-changes/global-api.html#a-note-for-plugin-authors

Try to change the Vue import to:

import Vue from 'vue/dist/vue'

See: Vue route: Uncaught TypeError: window.Vue.use is not a function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM