bootstrap-vue-wrapper
Version:
Bootstrap 5 components in Vue3 wrapper.
48 lines (47 loc) • 1.2 kB
JavaScript
import { Modal as d } from "bootstrap";
import { defineComponent as s } from "vue";
const n = s({
name: "BsModal",
props: {
/**
* Modal title
*/
title: {
type: String,
required: !0
},
classDialog: {
type: [String, Object],
default: null
},
hideHeader: {
type: Boolean,
default: !1
},
hideBody: {
type: Boolean,
default: !1
},
hideFooter: {
type: Boolean,
default: !1
}
},
emits: ["show", "shown", "hide", "hidden", "hidePrevented"],
mounted() {
const t = this.$refs.modalRef;
d.getOrCreateInstance(t).show(), t.addEventListener("show.bs.modal", (e) => this.$emit("show", e)), t.addEventListener("shown.bs.modal", (e) => this.$emit("shown", e)), t.addEventListener("hide.bs.modal", (e) => this.$emit("hide", e)), t.addEventListener("hidden.bs.modal", (e) => this.$emit("hidden", e)), t.addEventListener("hidePrevented.bs.modal", (e) => this.$emit("hidePrevented", e));
},
methods: {
/**
* Trigger modal hide event.
*/
hide() {
const t = this.$refs.modalRef;
d.getOrCreateInstance(t).hide();
}
}
});
export {
n as default
};