I am writing a Vue.js app with Bootstrap 4 and I can't loaded though I followed the documentation.
Added to main.js
Vue.use(BootstrapVue);
Added to css file related to App.vue:
@import '../../node_modules/bootstrap/dist/css/bootstrap.css';
@import '../../node_modules/bootstrap-vue/dist/bootstrap-vue.css';
Here is template:
<div class="main">
<div>
<b-modal id="modal1" title="Something went wrong" v-if="!serverStatusOk">
<p class="my-4">{{msg}}</p>
<p class="my-4">{{statusCode}}</p>
</b-modal>
</div>
<div>
<b-tab title="Players" active>
<br>Players data
</b-tab>
<b-tab title="Tournaments" active>
<br>Tournament data
</b-tab>
</div>
Result: no css rendered but in css file from dist dir I see Bootstrap What am I missing? The project created by vue-cli 3.0-beta
Solution:
Import to App.vue:
Try importing the files using JavaScript.
On closer inspection it looks like you're missing
<b-tabs>
also
<b-modal>
is controlled byv-model
That should fix the styling of the tabs.
I came across this same issue, but luckily I found the cause: The loader is not loaded :)
package.json
App.vue
, under the<script>
section, you should import:No need to use
@
or relativenode_modules
paths or anything.With these changes, it worked for me with Vue 2.5 and Bootstrap-Vue 2.0.0
Update:
Also, even though it feels a bit counter-intuitive, make sure you
use()
the Bootstrap-Vue package BEFORE you create thenew Vue()
in main.js. For example:If you do it in reverse order, it works only partially. For example some block elements will not have styles applied.