Procházet zdrojové kódy

游戏赋值修复

XianCH před 6 měsíci
rodič
revize
e69a0f3a63
1 změnil soubory, kde provedl 5 přidání a 5 odebrání
  1. 5 5
      src/components/Card/Card.tsx

+ 5 - 5
src/components/Card/Card.tsx

@@ -27,7 +27,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
     const wallet = useWalletStore((state) => state.wallet);
     // 判断是否有未结算的对局
     const gameModelRef = useRef<ModalProps>(null)
-    const game = useRef<GameListRep & { mode: GameRequest["mode"] } | null>(null);
+    const gameRef = useRef<GameListRep & { mode: GameRequest["mode"] } | null>(null);
 
     const [visible, setVisible] = useState(false);
 
@@ -86,7 +86,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
         }
         let unfinishedGame = gameList.find((item: { id: number }) => item?.id === game.id)
         if (unfinishedGame) {
-            game = unfinishedGame
+            gameRef.current = unfinishedGame
             setVisible(false);
             gameModelRef.current?.onOpen()
             return
@@ -95,9 +95,9 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
     };
 
     const goGame = () => {
-        getGameUrl(game.current!, {
-            id: game.current?.id + "",
-            mode: game.current?.mode!
+        getGameUrl(gameRef.current!, {
+            id: gameRef.current?.id + "",
+            mode: gameRef.current?.mode!
         });
     }
     return (