Answers for "bootstrap 5 in vue 3"

3

bootstrap 5 in vue 3

1. npm install --save bootstrap

2. In main.ts 
import "bootstrap/dist/css/bootstrap.min.css"
import "bootstrap"

3. If This error happens - dependency was not found: @popperjs/core in ./node_modules/bootstrap/dist/js/bootstrap.esm.js
npm install --save @popperjs/core

4. Now you can check with the bootstrap button to HelloWorld.vue -
<button class="btn btn-primary" 
            data-bs-target="#collapseTarget" 
            data-bs-toggle="collapse">
            Bootstrap collapse
        </button>
        <div class="collapse py-2" id="collapseTarget">
            This is the toggle-able content!
        </div>
Posted by: Guest on August-24-2021

Browse Popular Code Answers by Language