🐞 fix:

This commit is contained in:
john 2024-07-20 10:37:59 +08:00
parent 562a95ca9c
commit 61df3f063a
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import classes from "./Home.module.css"; import classes from "./Home.module.css";
import useUserStore from "@/store/User"; import useUserStore from "@/store/User";
import { cn, copyText, shortenString } from "@/utils"; import { cn, copyText, padWithZero, shortenString } from "@/utils";
import { useWeb3Modal } from "@web3modal/wagmi/react"; import { useWeb3Modal } from "@web3modal/wagmi/react";
import { useEffect, useMemo, useRef, useState } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -261,7 +261,7 @@ export default function () {
{userData?.nftId ? ( {userData?.nftId ? (
<div className={classes.nftToken_content_nft}> <div className={classes.nftToken_content_nft}>
<div className={classes.nftToken_content_nft_top}> <div className={classes.nftToken_content_nft_top}>
<span># {userData?.nftId}</span> <span># {padWithZero(userData?.nftId)}</span>
<span <span
onClick={() => { onClick={() => {
navigate("/mint"); navigate("/mint");

View File

@ -113,3 +113,8 @@ export function getUrlParameterByName(name: string, url?: string) {
console.log("url params:", results); console.log("url params:", results);
return decodeURIComponent(results[2].replace(/\+/g, " ")); return decodeURIComponent(results[2].replace(/\+/g, " "));
} }
export function padWithZero(num: number) {
// 将数字转换为字符串并在前面补足零使总长度为5
return String(num).padStart(5, "0");
}