feat: confirm before leaving during file upload (#10143)

This commit is contained in:
CityFun 2025-08-26 14:19:58 +08:00 committed by GitHub
parent 283609cf2d
commit ca84909716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -448,6 +448,18 @@ const acceptParams = (props: UploadFileProps) => {
});
};
onMounted(() => {
window.addEventListener('beforeunload', (e) => {
if (upLoading.value) {
if (upLoading.value) {
e.preventDefault();
e.returnValue = i18n.global.t('file.cancelUploadHelper');
return i18n.global.t('file.cancelUploadHelper');
}
}
});
});
defineExpose({ acceptParams, handleDrop, open });
</script>