implementing snapshots

This commit is contained in:
Emily
2024-07-30 15:04:56 +02:00
parent bc27d7cded
commit f72bc33871
9 changed files with 338 additions and 31 deletions

View File

@@ -4,17 +4,42 @@ import type { Component } from "vue";
const showDialog = ref<boolean>(false);
const dialogParams = ref<any>({});
const dialogComponent = ref<Component>();
const dialogWidth = ref<string>("100%");
const dialogHeight = ref<string>("100%");
const dialogClosable = ref<boolean>(true);
function closeDialog() {
showDialog.value = false;
}
export type CustomDialogOptions = {
params?: any,
width?: string,
height?: string,
closable?: boolean
}
function openDialogEx(component: Component, options?: CustomDialogOptions) {
dialogComponent.value = component;
dialogParams.value = options?.params || {};
showDialog.value = true;
dialogWidth.value = options?.width || '100%';
dialogHeight.value = options?.height || '100%';
dialogClosable.value = options?.closable ?? true;
}
function openDialog(component: Component, params: any) {
dialogComponent.value = component;
dialogParams.value = params;
showDialog.value = true;
dialogWidth.value = '100%';
dialogHeight.value = '100%';
}
const dialogStyle = computed(() => {
return `width: ${dialogWidth.value}; height: ${dialogHeight.value}`;
});
export function useCustomDialog() {
return { showDialog, closeDialog, openDialog, dialogParams, dialogComponent };
return { showDialog, openDialogEx, closeDialog, openDialog, dialogParams, dialogComponent, dialogStyle, dialogClosable };
}