11<template >
2- <div >Home</div >
3- </template >
2+ <div class =" row align-items-md-stretch" >
3+ <div class =" col-md-6 mb-4" >
4+ <div class =" h-100 p-5 text-white bg-dark rounded-3" >
5+ <h2 >{{ msg }}</h2 >
6+ <p >Before getting started with Bootstrap’s modal component, be sure to read the following as our menu options have recently changed.</p >
7+ <ul >
8+ <li >
9+ Modals are built with HTML, CSS, and JavaScript. They’re positioned over everything else in the document and remove scroll from the
10+ <code class =" highlighter-rouge" >< ; body> ; </code >
11+ so that modal content scrolls instead.
12+ </li >
13+ <li >Clicking on the modal “backdrop” will automatically close the modal.</li >
14+ <li >Bootstrap only supports one modal window at a time. Nested modals aren’t supported as we believe them to be poor user experiences.</li >
15+ <li >
16+ Modals use
17+ <code class =" highlighter-rouge" >position: fixed</code >
18+ , which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You’ll likely run into issues when nesting a
19+ <code class =" highlighter-rouge" >.modal</code >
20+ within another fixed element.
21+ </li >
22+ <li >
23+ Once again, due to
24+ <code class =" highlighter-rouge" >position: fixed</code >
25+ , there are some caveats with using modals on mobile devices.
26+ <a href =" https://getbootstrap.com/docs/4.0/getting-started/browsers-devices/#modals-and-dropdowns-on-mobile" target =" _blank" rel =" noopener noreferrer" >See our browser support docs</a >
27+ for details.
28+ </li >
29+ <li >
30+ Due to how HTML5 defines its semantics,
31+ <a href =" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autofocus" target =" _blank" rel =" noopener noreferrer" >
32+ the
33+ <code class =" highlighter-rouge" >autofocus</code >
34+ HTML attribute
35+ </a >
36+ has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:
37+ </li >
38+ </ul >
39+
40+ <button type =" button" class =" btn btn-outline-light" @click =" modal.show()" >Launch modal</button >
41+ <div class =" modal fade" ref =" infoModal" tabindex =" -1" aria-hidden =" true" >
42+ <div class =" modal-dialog" >
43+ <div class =" modal-content" >
44+ <div class =" modal-header" >
45+ <h5 class =" modal-title text-dark" id =" infoModalLabel" >How many clicks you've passed?!</h5 >
46+ <button type =" button" class =" btn-close" @click =" modal.hide()" aria-label =" Close" ></button >
47+ </div >
48+ <div class =" modal-body" >
49+ <button @click =" state.count++" class =" btn btn-primary text-uppercase" >You clicked me {{ state.count }} time{{ state.count === 1 ? "" : "s" }}</button >
50+ </div >
51+ <div class =" modal-footer" >
52+ <button type =" button" class =" btn btn-secondary" @click =" modal.hide()" >Close</button >
53+ </div >
54+ </div >
55+ </div >
56+ </div >
57+ </div >
58+ </div >
59+ <div class =" col-md-6 mb-4" >
60+ <div class =" p-5 bg-light border rounded-3 mb-4" >
61+ <h2 >Bootstrap Toast</h2 >
62+ <p >Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.</p >
63+
64+ <button type =" button" class =" btn btn-outline-secondary" @click =" toast.show()" >Show Toast</button >
65+ <div class =" position-fixed bottom-0 end-0 p-3 emerge-11" >
66+ <div ref =" bsToast" class =" toast hide" role =" alert" aria-live =" assertive" aria-atomic =" true" >
67+ <div class =" toast-header bg-info text-dark" >
68+ <i class =" bi bi-hand-index me-1" ></i >
69+ <strong class =" me-auto" >Which finger?!</strong >
70+ <small >Some times ago</small >
71+ <button type =" button" class =" btn-close" data-bs-dismiss =" toast" aria-label =" Close" ></button >
72+ </div >
73+ <div class =" toast-body bg-light" >Hello, world! This is a toast message.</div >
74+ </div >
75+ </div >
76+ </div >
77+ <div class =" p-5 bg-light border rounded-3" >
78+ <h2 >Bootstrap Grid</h2 >
79+ <p >
80+ Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with
81+ <a href =" https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox" target =" _blank" rel =" noopener noreferrer" >flexbox</a >
82+ and is fully responsive. Below is an example and an in-depth explanation for how the grid system comes together.
83+ </p >
84+ <div class =" bd-example bd-example-row" >
85+ <div class =" row" >
86+ <div class =" col-12 col-lg-8" >.col-12 .col-lg-8</div >
87+ <div class =" col-12 col-lg-4" >.col-12 .col-lg-4</div >
88+ </div >
89+
90+ <div class =" row" >
91+ <div class =" col-6 col-md-4" >.col-6 .col-md-4</div >
92+ <div class =" col-6 col-md-4" >.col-6 .col-md-4</div >
93+ <div class =" col-12 col-md-4" >.col-12 .col-md-4</div >
94+ </div >
95+
96+ <div class =" row" >
97+ <div class =" col-6" >.col-6</div >
98+ <div class =" col-6" >.col-6</div >
99+ </div >
100+ </div >
101+ </div >
102+ <div class =" p-5 bg-light border rounded-3 mt-4 d-flex justify-content-between" >
103+ <i class =" bi bi-house-fill" ></i >
104+ <i class =" bi bi-boxes" ></i >
105+ <i class =" bi bi-car-front-fill" ></i >
106+ <i class =" bi bi-cart4" ></i >
107+ <i class =" bi bi-cloud-snow" ></i >
108+ <i class =" bi bi-gear" ></i >
109+ </div >
110+ </div >
111+ </div >
112+ </template >
113+
114+ <script lang="ts" setup>
115+ import { reactive , onMounted , ref } from " vue" ;
116+ import { Modal , Toast } from " bootstrap" ;
117+
118+ const props = defineProps ([' msg' ]);
119+
120+ const state = reactive ({ count: 0 });
121+ const modal = ref ();
122+ const toast = ref ();
123+ const infoModal = ref ();
124+ const bsToast = ref ();
125+
126+ onMounted (() => {
127+ modal .value = new Modal (infoModal .value );
128+ toast .value = new Toast (bsToast .value );
129+ });
130+ </script >
0 commit comments