guofei 2024-10-23 15:25:40 +08:00
parent ba61cd083f
commit 19e391c2c2
1 changed files with 1 additions and 24 deletions

View File

@ -20,28 +20,6 @@ export default function Examples(props: { dict: Record<string, string>; lang: st
fetchData();
}, []);
const [progress, setProgress] = useState(0);
const timer = useRef<NodeJS.Timeout>();
useEffect(() => {
if (previewInfo.preview) {
setProgress(0);
timer.current = setInterval(() => {
if (progress === 100) {
clearInterval(timer.current);
return;
}
setProgress((prevProgress) => {
if (prevProgress >= 90) {
clearInterval(timer.current);
return 90;
}
return prevProgress + 10;
});
}, 1000);
}
}, [previewInfo.preview]);
return (
<>
<div className="w-[96%] flex flex-wrap mt-[34px] mb-[83px] mx-auto">
@ -92,8 +70,7 @@ export default function Examples(props: { dict: Record<string, string>; lang: st
onClick={(e) => {
e.stopPropagation();
}}
>
{progress < 90 && <div className="text-red-500 font-bold text-3xl text-center absolute z-[30]">{progress}%</div>}
>1
<iframe src={previewInfo.url} className="w-full h-full" />
</div>
</div>