feat:

切换中文语言自动切换区号
This commit is contained in:
john 2024-06-13 16:38:00 +08:00
parent c2e89373b6
commit a97072958a
1 changed files with 4 additions and 1 deletions

View File

@ -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<number>(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);
}}
>