feat: add before close function
This commit is contained in:
parent
97e234a225
commit
6364fbd4ab
2 changed files with 13 additions and 3 deletions
|
|
@ -34,7 +34,7 @@ const props = withDefaults(
|
||||||
employee?: boolean;
|
employee?: boolean;
|
||||||
employeeOwnerOption?: CustomerBranch[];
|
employeeOwnerOption?: CustomerBranch[];
|
||||||
prefixId: string;
|
prefixId: string;
|
||||||
showBtnSave: boolean;
|
showBtnSave?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showBtnSave: false,
|
showBtnSave: false,
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,18 @@ defineProps<{
|
||||||
submit?: (...args: unknown[]) => void;
|
submit?: (...args: unknown[]) => void;
|
||||||
close?: (...args: unknown[]) => void;
|
close?: (...args: unknown[]) => void;
|
||||||
undo?: (...args: unknown[]) => void;
|
undo?: (...args: unknown[]) => void;
|
||||||
|
beforeClose?: (...args: unknown[]) => boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const modal = defineModel('modal', { default: false });
|
const modal = defineModel('modal', { default: false });
|
||||||
const currentTab = defineModel<string>('currentTab');
|
const currentTab = defineModel<string>('currentTab');
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="modal" @hide="close" @before-show="show">
|
<q-dialog
|
||||||
|
:model-value="modal"
|
||||||
|
@update:model-value="(v) => (modal = beforeClose ? beforeClose() : v)"
|
||||||
|
@before-show="show"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="surface-1"
|
class="surface-1"
|
||||||
style="padding: 0; border-radius: var(--radius-2); height: 100%"
|
style="padding: 0; border-radius: var(--radius-2); height: 100%"
|
||||||
|
|
@ -129,7 +134,12 @@ const currentTab = defineModel<string>('currentTab');
|
||||||
padding="xs"
|
padding="xs"
|
||||||
class="close-btn"
|
class="close-btn"
|
||||||
:class="{ dark: $q.dark.isActive }"
|
:class="{ dark: $q.dark.isActive }"
|
||||||
@click="close"
|
@click="
|
||||||
|
() => {
|
||||||
|
modal = beforeClose ? beforeClose() : !modal;
|
||||||
|
close?.();
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue