You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
uptime-kuma/src/components/Confirm.vue

69 lines
1.9 KiB

3 years ago
<template>
3 years ago
<div ref="modal" class="modal fade" tabindex="-1">
3 years ago
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
3 years ago
<h5 id="exampleModalLabel" class="modal-title">
{{ $t("Confirm") }}
3 years ago
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" />
3 years ago
</div>
<div class="modal-body">
3 years ago
<slot />
3 years ago
</div>
<div class="modal-footer">
3 years ago
<button type="button" class="btn" :class="btnStyle" data-bs-dismiss="modal" @click="yes">
{{ yesText }}
3 years ago
</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
{{ noText }}
3 years ago
</button>
3 years ago
</div>
</div>
</div>
</div>
</template>
<script>
import { Modal } from "bootstrap";
3 years ago
export default {
props: {
/** Style of button */
3 years ago
btnStyle: {
type: String,
3 years ago
default: "btn-primary",
},
/** Text to use as yes */
yesText: {
type: String,
default: "Yes", // TODO: No idea what to translate this
},
/** Text to use as no */
noText: {
type: String,
default: "No",
},
3 years ago
},
emits: [ "yes" ],
3 years ago
data: () => ({
3 years ago
modal: null,
3 years ago
}),
mounted() {
this.modal = new Modal(this.$refs.modal);
3 years ago
},
methods: {
/** Show the confirm dialog */
3 years ago
show() {
this.modal.show();
3 years ago
},
/**
* @emits string "yes" Notify the parent when Yes is pressed
*/
3 years ago
yes() {
3 years ago
this.$emit("yes");
},
},
};
3 years ago
</script>