forked from verdnatura/salix-front
refs #6664 vnConfirm og
This commit is contained in:
parent
35aa0ba20a
commit
67d95f9ad0
|
@ -2,7 +2,6 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -29,7 +28,6 @@ const props = defineProps({
|
||||||
required: false,
|
required: false,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
callbackFn: Function,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
@ -39,17 +37,12 @@ const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||||
const title = props.title || t('Confirm');
|
const title = props.title || t('Confirm');
|
||||||
const message = props.message || t('Are you sure you want to continue?');
|
const message = props.message || t('Are you sure you want to continue?');
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
onMounted(() => {
|
|
||||||
if (props.callbackFn) props.callbackFn();
|
|
||||||
});
|
|
||||||
async function confirm() {
|
async function confirm() {
|
||||||
let html = null;
|
|
||||||
html = document.getElementById(props.data.inputId);
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
if (props.promise) {
|
if (props.promise) {
|
||||||
try {
|
try {
|
||||||
if (html) await props.promise({ ...props.data, return: html.value });
|
await props.promise(props.data);
|
||||||
else await props.promise(props.data);
|
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
@ -72,8 +65,8 @@ async function confirm() {
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="row justify-center items-center">
|
<QCardSection class="row items-center">
|
||||||
<span id="spanHTML" v-html="message"></span>
|
<span v-html="message"></span>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
Loading…
Reference in New Issue