"在 'vue' 中找不到导出 'default'(导入为 'Vue') [英] "export 'default' (imported as 'Vue') was not found in 'vue'
问题描述
我是 VueJs 的初学者,这是我的第一个应用程序:
I am a beginner with VueJs and this is my first App:
import { BootstrapVue } from 'bootstrap-vue'
import { createApp } from 'vue'
import App from './App.vue'
const myApp = createApp(App)
myApp.use(BootstrapVue)
myApp.mount('#app')
当我保存时,我的浏览器中没有任何显示,它在命令中显示此消息:
And when I save, nothing appears in my browser and it show this message in the Command:
warning in ./src/main.js
"export 'default' (imported as 'Vue') was not found in 'vue'
推荐答案
Bootstrap-Vue 尚不支持 Vue 3.所以如果你想使用 Bootstrap-Vue,你现在必须坚持使用 Vue 2.
Bootstrap-Vue does not yet support Vue 3. So if you want to use Bootstrap-Vue you will have to stick with Vue 2 for now.
总的来说,大多数库还不支持 Vue 3,所以我建议在使用它之前等待一段时间,直到生态系统跟上.
In general, most of the libraries don't support Vue 3 yet, so I would suggest waiting a bit longer before using it until the ecosystem has caught up.
发生这种情况的原因是在 Vue 2 中,Vue 提供了默认导出 export default vue
,这允许 BootstrapVue 使用 import Vue from 'vue'
.
The reason this is happening is because in Vue 2, Vue provides a default export export default vue
, which allows BootstrapVue to use import Vue from 'vue'
.
然而,在 Vue 3 中这已经改变了,Vue 不再提供默认导出,而是使用命名导出.所以当 BootstrapVue 使用下面这行 import Vue from 'vue'
时,就会出现错误.
However, in Vue 3 this has changed, and Vue does no longer provide a default export, and instead uses named exports. So when BootstrapVue uses the following line import Vue from 'vue'
, the error occurs.
这篇关于"在 'vue' 中找不到导出 'default'(导入为 'Vue')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!