2

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?

1 Answer 1

8

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')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.