HTML
xxxxxxxxxx
1
<template>
2
<!-- Button trigger modal -->
3
<MDBBtn
4
color="primary"
5
aria-controls="exampleModal"
6
@click="exampleModal=true"
7
>
8
Launch demo modal
9
</MDBBtn>
10
<MDBModal
11
id="exampleModal"
12
tabindex="-1"
13
labelledby="exampleModalLabel"
14
v-model="exampleModal"
15
>
16
<MDBModalHeader>
17
<MDBModalTitle id="exampleModalLabel"> Modal title </MDBModalTitle>
18
</MDBModalHeader>
19
<MDBModalBody>...</MDBModalBody>
20
<MDBModalFooter>
21
<MDBBtn color="secondary" @click="exampleModal = false">Close</MDBBtn>
22
<MDBBtn color="primary">Save changes</MDBBtn>
23
</MDBModalFooter>
24
</MDBModal>
25
26
<MDBBtn
27
color="primary"
28
aria-controls="inputModal"
29
@click="inputModal=true"
30
>
31
Launch input modal
32
</MDBBtn>
33
34
<MDBModal
35
id="inputModal"
36
tabindex="-1"
37
labelledby="inputModalLabel"
38
v-model="inputModal"
39
>
40
<MDBModalHeader>
41
<MDBModalTitle id="inputModalLabel"> Modal title </MDBModalTitle>
42
</MDBModalHeader>
43
<MDBModalBody>
44
<MDBInput v-model="inputValue" />
45
</MDBModalBody>
46
<MDBModalFooter>
47
<MDBBtn color="secondary" @click="inputModal = false">Close</MDBBtn>
48
<MDBBtn color="primary">Save changes</MDBBtn>
49
</MDBModalFooter>
50
</MDBModal>
51
</template>
SCSS
xxxxxxxxxx
1
<style>
2
#app {
3
font-family: Roboto, Helvetica, Arial, sans-serif;
4
}
5
</style>
JS
xxxxxxxxxx
1
<script>
2
import {
3
MDBModal,
4
MDBModalHeader,
5
MDBModalTitle,
6
MDBModalBody,
7
MDBModalFooter,
8
MDBBtn,
9
MDBInput
10
} from 'mdb-vue-ui-kit';
11
import { ref } from 'vue';
12
export default {
13
components: {
14
MDBModal,
15
MDBModalHeader,
16
MDBModalTitle,
17
MDBModalBody,
18
MDBModalFooter,
19
MDBBtn,
20
MDBInput,
21
},
22
setup() {
23
const exampleModal = ref(false);
24
const inputModal = ref(false);
25
const inputValue = ref('Select this text and drag your cursor outside the window');
26
27
return {
28
exampleModal,
29
inputModal,
30
inputValue,
31
};
32
},
33
};
34
</script>
Console errors: 0