Uncaught TypeError: Vue.extend is not a function
Uncaught TypeError: Vue.extend is not a function
从 vue 2 迁移后,我在浏览器中收到以下错误
Uncaught TypeError: Vue.extend is not a function
我的main.js文件在下面
import { createApp } from 'vue'
import App from './App.vue'
import VueAxios from 'vue-axios'
import axios from 'axios'
import router from './router'
import store from './store'
import Clipboard from 'v-clipboard'
import Vidle from 'v-idle'
const app = createApp({
el: '#app',
store,
router,
axios,
render: (h) => h(App),
}).mount('#app')
app.use(store)
app.use(router)
app.use(Vidle)
app.use(Clipboard)
app.use(VueAxios, axios)
app.config.productionTip = false;
export const stores = store
下面是我的插件和依赖项,其中哪一个可能会导致浏览器出现错误?
"dependencies": {
"axios": "^0.26.1",
"core-js": "^3.8.3",
"jquery": "^3.6.0",
"node-sass": "^7.0.1",
"v-clipboard": "^2.2.3",
"v-idle": "^0.2.1",
"vue": "^3.2.13",
"vue-axios": "^3.4.1",
"vue-pdf-app": "^2.1.0",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/test-utils": "^2.0.0-0",
"@vue/vue3-jest": "^27.0.0-alpha.1",
"babel-jest": "^27.0.6",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^27.0.5",
"sass-loader": "^12.6.0",
"typescript": "^4.6.3"
}
我该如何解决这个问题。
提前致谢
Vue.extend 在 Vue 3 中不存在。您的某个插件必须正在使用它,这意味着除非您的插件具有更新版本,否则它将不兼容。
该错误应包含堆栈跟踪,其中包含不兼容插件的路径。如果不是,则删除所有插件,然后将它们一一添加回来,直到发生错误。
从 vue 2 迁移后,我在浏览器中收到以下错误
Uncaught TypeError: Vue.extend is not a function
我的main.js文件在下面
import { createApp } from 'vue'
import App from './App.vue'
import VueAxios from 'vue-axios'
import axios from 'axios'
import router from './router'
import store from './store'
import Clipboard from 'v-clipboard'
import Vidle from 'v-idle'
const app = createApp({
el: '#app',
store,
router,
axios,
render: (h) => h(App),
}).mount('#app')
app.use(store)
app.use(router)
app.use(Vidle)
app.use(Clipboard)
app.use(VueAxios, axios)
app.config.productionTip = false;
export const stores = store
下面是我的插件和依赖项,其中哪一个可能会导致浏览器出现错误?
"dependencies": {
"axios": "^0.26.1",
"core-js": "^3.8.3",
"jquery": "^3.6.0",
"node-sass": "^7.0.1",
"v-clipboard": "^2.2.3",
"v-idle": "^0.2.1",
"vue": "^3.2.13",
"vue-axios": "^3.4.1",
"vue-pdf-app": "^2.1.0",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/test-utils": "^2.0.0-0",
"@vue/vue3-jest": "^27.0.0-alpha.1",
"babel-jest": "^27.0.6",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^27.0.5",
"sass-loader": "^12.6.0",
"typescript": "^4.6.3"
}
我该如何解决这个问题。
提前致谢
Vue.extend 在 Vue 3 中不存在。您的某个插件必须正在使用它,这意味着除非您的插件具有更新版本,否则它将不兼容。
该错误应包含堆栈跟踪,其中包含不兼容插件的路径。如果不是,则删除所有插件,然后将它们一一添加回来,直到发生错误。