From 1c548306148b41d3627027c416a0e8669bf8cf7f Mon Sep 17 00:00:00 2001 From: durunsong Date: Wed, 16 Oct 2024 16:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=A3feat=EF=BC=9A=E6=A1=88=E4=BE=8Bhook?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/package/en.ts | 2 ++ src/i18n/package/zh.ts | 2 ++ src/service/hook-demo/use-fullscreen-loading.ts | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/i18n/package/en.ts b/src/i18n/package/en.ts index 4b91e75..560b903 100644 --- a/src/i18n/package/en.ts +++ b/src/i18n/package/en.ts @@ -249,6 +249,8 @@ const en = { character: "Character", Please_select_your_role: "Please select your role", Selecting_a_Character: "Selecting a Character", + Get_Success: "Get Success", + error_occurs: "Error occurs", }; export default en; diff --git a/src/i18n/package/zh.ts b/src/i18n/package/zh.ts index 736c5ff..d2a8fce 100644 --- a/src/i18n/package/zh.ts +++ b/src/i18n/package/zh.ts @@ -243,6 +243,8 @@ const zh = { character: "角色", Please_select_your_role: "请选择你的角色", Selecting_a_Character: "选择角色", + Get_Success: "获取成功", + error_occurs: "发生错误", }; export default zh; diff --git a/src/service/hook-demo/use-fullscreen-loading.ts b/src/service/hook-demo/use-fullscreen-loading.ts index e829a93..632331b 100644 --- a/src/service/hook-demo/use-fullscreen-loading.ts +++ b/src/service/hook-demo/use-fullscreen-loading.ts @@ -1,10 +1,13 @@ +import i18n from "@/i18n"; +const { t } = i18n.global; + /** 模拟接口响应数据 */ const SUCCESS_RESPONSE_DATA = { code: 0, data: { list: [] as number[], }, - message: "获取成功", + message: t("Get_Success"), }; /** 模拟请求接口成功 */ @@ -20,7 +23,7 @@ export function getSuccessApi(list: number[]) { export function getErrorApi() { return new Promise((_resolve, reject) => { setTimeout(() => { - reject(new Error("发生错误")); + reject(new Error(t("error_occurs"))); }, 1000); }); }