Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vuejs 3 multiple plugins

How can I use multiple plugins within vuejs 3?

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';

createApp(App).use(router, axios, Antd).mount('#app')

Within Main.js, this seems to import router and axios, but not Antd. If I take off router, and axios then I can see antd components. How do I bring in everything?

like image 326
dataviews Avatar asked Nov 28 '25 18:11

dataviews


1 Answers

Each plugin must be in its own app.use() call:

createApp(App).use(pluginA).use(pluginB).use(pluginC).mount('#app')

However, axios is not a Vue plugin, so don't install that with app.use().

Your code should look similar to this:

createApp(App).use(router).use(Antd).mount('#app')
like image 198
tony19 Avatar answered Dec 02 '25 03:12

tony19



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!