From 829b86160d68d986e0303556b3c6abf7b2e837ee Mon Sep 17 00:00:00 2001 From: Shua-github Date: Sun, 29 Dec 2024 17:15:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=98=E6=98=AF=E6=B2=A1=E5=88=A0?= =?UTF-8?q?=E5=A5=BD(=E5=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 809ab54..67bd9ce 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -15,6 +15,8 @@ import { preloadFont } from "./utils/preload"; const { ClipboardItem } = window; function App() { + const [rand, setRand] = useState(0); + useEffect(() => { let controller; try { @@ -160,7 +162,8 @@ function App() { link.style.display = "none"; document.body.appendChild(link); link.click(); - document.body.removeChild(link);; + document.body.removeChild(link); + setRand(rand + 1); }; function b64toBlob(b64Data, contentType = null, sliceSize = null) { @@ -182,16 +185,18 @@ function App() { const copy = async () => { const canvas = document.getElementsByTagName("canvas")[0]; - await navigator.clipboard.write([ + await navigator.clipboard.write([ new ClipboardItem({ "image/png": b64toBlob(canvas.toDataURL().split(",")[1]), }), ]); setOpenCopySnackbar(true); + setRand(rand + 1); }; return (
+