1

I am trying to use Bootstrap in my Vue project. (created with the Vue cli)
I have installed the following things through npm.

  • Bootstrap 4.6.0
  • Popper.js 1.16.1
  • Jquery 3.5.1

I have imported Bootsrap into my main.js

import 'bootstrap'
import 'bootstrap/dist/css/bootstrap.min.css'

The problem is that I can't use the dropdowns in Bootsrap.
Is there anything else I should do?

1

1 Answer 1

2

there is bootstrap package specially for vue you can use the following commands to install it

npm install bootstrap-vue

OR

yarn add bootstrap-vue

and then in your main.js file you can import it and use it as

import BootstrapVue from 'bootstrap-vue';
import 'bootstrap-vue/dist/bootstrap-vue.css';

Vue.use(BootstrapVue)
Sign up to request clarification or add additional context in comments.

4 Comments

Can I use the basic way of just putting classes on things, or I have to use the custom tags they provide?
you need to use the custom tags that they mention in the docs and it also depends whether you use scoped/non-scoped stylings
if you found this answer useful, pls consider giving it an upvote .. thanks:)\
@HUNcut_ Can I use the basic way of just putting classes on things, Yes you can. You don't have to use the components, though I do recommend it, as it's usually less markup, and more unified. However, this is only valid for stuff that's 100% CSS based. For components that usually require Bootstrap.js like Modals, Dropdowns, Toasts, Popover/Tooltips, ect.. You will need to use their vue component counterparts.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.