📅  最后修改于: 2022-03-11 15:02:38.994000             🧑  作者: Mango
//101-Example
const callback = useCallback((event: any) => {
event.data.status === "complete" ? setProgress(0) : setProgress(event.data.uploadProgress);
},[])
useEffect(() => {
window.addEventListener("file-upload", callback);
return () => window.removeEventListener("file-upload", callback);
}, [window, callback]);