如何使用 Vue 3 &添加插件Boostrap-vue? [英] How to use Vue 3 & Add Plugin Boostrap-vue?
问题描述
我尝试使用 Vue 3,但我看起来无法再次使用 Vue.use(exampleplugin).
I try using Vue 3, but I look can't using Vue.use(exampleplugin) again.
我在生成 vue 创建项目后使用命令 vue add bootstrap-vue.和插件 bootstrap-vue 警告代码:
I using command vue add bootstrap-vue after generate vue create project. And on plugin bootstrap-vue warning with code:
import Vue from "vue";
import BootstrapVue from "bootstrap-vue";
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap-vue/dist/bootstrap-vue.css";
Vue.use(BootstrapVue);
输出警告终端:
./src/plugins/bootstrap-vue.js 中的警告
warning in ./src/plugins/bootstrap-vue.js
"在 'vue' 中找不到导出 'default'(导入为 'Vue')
"export 'default' (imported as 'Vue') was not found in 'vue'
./node_modules/bootstrap-vue/esm/utils/vue.js 中的警告
warning in ./node_modules/bootstrap-vue/esm/utils/vue.js
"在 'vue' 中找不到导出 'default'(导入为 'Vue')
"export 'default' (imported as 'Vue') was not found in 'vue'
这有什么问题?以及如何使用 vue 3 添加插件 bootstrap-vue?
What's wrong with that? And how do I use vue 3 to add plugin bootstrap-vue?
推荐答案
Bootstrap Vue 尚未为 Vue 3 做好准备.
Bootstrap Vue is not yet ready for Vue 3.
为了回答您的部分问题,Vue 3 更改了实例化应用程序实例的方法,包括如何注册插件.
To answer part of your question, Vue 3 changes the method for instantiating the application instance, including how plugins are registered.
例如...
import { createApp } from 'vue';
import Router from './router/Router';
createApp({/* options */}})
.use(Router)
.mount('#app');
您可以在官方文档中阅读更多相关信息.
You can read more about this at the official docs.
https://v3.vuejs.org/guide/instance.html
https://v3.vuejs.org/guide/migration/introduction.html
这篇关于如何使用 Vue 3 &添加插件Boostrap-vue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!