fix: Clear the input box when closing the search (#4467)

Signed-off-by: aonoa <1991849113@qq.com>
This commit is contained in:
aonoa 2024-09-22 20:38:01 +08:00 committed by GitHub
parent 31f6cc6416
commit 4b3d2d21ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,16 +30,21 @@ const props = withDefaults(
},
);
const keyword = ref('');
const searchInputRef = ref<HTMLInputElement>();
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<HTMLInputElement>();
function handleClose() {
modalApi.close();
keyword.value = '';