diff --git a/packages/effects/layouts/src/widgets/global-search/global-search.vue b/packages/effects/layouts/src/widgets/global-search/global-search.vue index 017bc329968..ae002622f3d 100644 --- a/packages/effects/layouts/src/widgets/global-search/global-search.vue +++ b/packages/effects/layouts/src/widgets/global-search/global-search.vue @@ -30,16 +30,21 @@ const props = withDefaults( }, ); +const keyword = ref(''); +const searchInputRef = ref(); + const [Modal, modalApi] = useVbenModal({ onCancel() { modalApi.close(); }, + onOpenChange(isOpen: boolean) { + if (!isOpen) { + keyword.value = ''; + } + }, }); const open = modalApi.useStore((state) => state.isOpen); -const keyword = ref(''); -const searchInputRef = ref(); - function handleClose() { modalApi.close(); keyword.value = '';