fix: the onOpenChange event for the modal component does not work as expected (#4425)

pull/48/MERGE
Vben 2024-09-18 22:44:46 +08:00 committed by GitHub
parent 2c22825546
commit 834cb4c470
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View File

@ -112,6 +112,7 @@ function createCssOptions(injectGlobalScss = true) {
}
return content;
},
api: 'modern-compiler',
},
}
: {},

View File

@ -54,10 +54,10 @@ export function useVbenDrawer<
...options,
} as DrawerApiOptions;
// mergedOptions.onOpenChange = (isOpen: boolean) => {
// options.onOpenChange?.(isOpen);
// injectData.options?.onOpenChange?.(isOpen);
// };
mergedOptions.onOpenChange = (isOpen: boolean) => {
options.onOpenChange?.(isOpen);
injectData.options?.onOpenChange?.(isOpen);
};
const api = new DrawerApi(mergedOptions);
const extendedApi: ExtendedDrawerApi = api as never;

View File

@ -58,10 +58,10 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
...options,
} as ModalApiOptions;
// mergedOptions.onOpenChange = (isOpen: boolean) => {
// options.onOpenChange?.(isOpen);
// injectData.options?.onOpenChange?.(isOpen);
// };
mergedOptions.onOpenChange = (isOpen: boolean) => {
options.onOpenChange?.(isOpen);
injectData.options?.onOpenChange?.(isOpen);
};
const api = new ModalApi(mergedOptions);
const extendedApi: ExtendedModalApi = api as never;