new awesome build
This commit is contained in:
1 parent
848646003c
commit
fcb8f6bac7
119 files changed
+7291
-5575
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<BaseModal id="confirmModal" :title="title" ref="modal">
|
||||
<template #body>
|
||||
<p class="text-main">{{ message }}</p>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button v-if="showCancel" type="button" class="btn-action btn-action-secondary" @click="close">Cancel</button>
|
||||
<button type="button" class="btn-action" :class="confirmBtnClass" @click="confirm">
|
||||
{{ confirmText }}
|
||||
</button>
|
||||
</template>
|
||||
</BaseModal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import BaseModal from './BaseModal.vue';
|
||||
|
||||
const emit = defineEmits(['confirm']);
|
||||
const modal = ref(null);
|
||||
|
||||
const title = ref('');
|
||||
const message = ref('');
|
||||
const confirmText = ref('Confirm');
|
||||
const confirmBtnClass = ref('btn-action-danger');
|
||||
const showCancel = ref(true);
|
||||
const data = ref(null);
|
||||
|
||||
const open = (opts) => {
|
||||
title.value = opts.title || 'Are you sure?';
|
||||
message.value = opts.message || '';
|
||||
confirmText.value = opts.confirmText || 'Confirm';
|
||||
confirmBtnClass.value = opts.confirmBtnClass || 'btn-action-danger';
|
||||
showCancel.value = opts.showCancel !== false;
|
||||
data.value = opts.data || null;
|
||||
modal.value.show();
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
modal.value.hide();
|
||||
};
|
||||
|
||||
const confirm = () => {
|
||||
emit('confirm', data.value);
|
||||
close();
|
||||
};
|
||||
|
||||
defineExpose({ open, close });
|
||||
</script>
|
||||
Reference in new issue
Block a user