Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Vue 3 & Add Plugin Boostrap-vue?

I try using Vue 3, but I look can't using Vue.use(exampleplugin) again.

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);

Output warning terminal:

warning in ./src/plugins/bootstrap-vue.js

"export 'default' (imported as 'Vue') was not found in 'vue'

warning in ./node_modules/bootstrap-vue/esm/utils/vue.js

"export 'default' (imported as 'Vue') was not found in 'vue'

What's wrong with that? And how do I use vue 3 to add plugin bootstrap-vue?

like image 678
Zoro Raka Avatar asked Aug 25 '20 00:08

Zoro Raka


People also ask

What is Vue 3 used for?

Vue 3 provides developers with an alternative and better way to build Vue applications. The introduction of the Composition API and composition functions in Vue 3 has made code organization and reusability a breeze.

Is the Vue 3 free?

Vue is a free and open source project released under the MIT License.


1 Answers

Bootstrap Vue is not yet ready for Vue 3.

To answer part of your question, Vue 3 changes the method for instantiating the application instance, including how plugins are registered.

For example...

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

like image 82
Tom Bowers Avatar answered Sep 28 '22 02:09

Tom Bowers