From a97072958a1678cbe21e8b2464860b41c7af7a33 Mon Sep 17 00:00:00 2001 From: john Date: Thu, 13 Jun 2024 16:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 切换中文语言自动切换区号 --- src/pages/SignIn.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/SignIn.tsx b/src/pages/SignIn.tsx index be23e42..e64244c 100644 --- a/src/pages/SignIn.tsx +++ b/src/pages/SignIn.tsx @@ -11,6 +11,7 @@ import { useNavigate } from "react-router-dom"; import useUserStore from "../store/user.ts"; import { Popover } from "antd-mobile"; import EmailForm from "../components/EmailForm.tsx"; +import Area from "../i18n/area/area.json"; function SignIn() { const { t, i18n } = useTranslation(); @@ -20,7 +21,7 @@ function SignIn() { const [selectIndex, setSelectIndex] = useState(1); const { previousPathName, UpdatePreviousPathName } = useUserStore(); const navigate = useNavigate(); - const { UpdateLang } = useUserStore(); + const { UpdateLang, UpdateSelectCountry } = useUserStore(); const handleTabs = (num: number) => { return () => { UpdatePreviousPathName("/"); @@ -72,6 +73,8 @@ function SignIn() { i18n.changeLanguage("cn"); setVisible(false); UpdateLang("zh-TW"); + const areaItem = Area.find((v) => v.code == "+86"); + if (areaItem) UpdateSelectCountry(areaItem); }} > 中文(繁体)