Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态获取国际化失败,在setupI18n.ts中只要调用请求,页面就无法访问 #3825

Open
4 tasks done
kimjdd opened this issue May 9, 2024 · 1 comment
Open
4 tasks done

Comments

@kimjdd
Copy link

kimjdd commented May 9, 2024

⚠️ 重要 ⚠️ 在进一步操作之前,请检查下列选项。如果您忽视此模板或者没有提供关键信息,您的 Issue 将直接被关闭

  • 已阅读 文档.
  • 确保您的代码已是最新或者所报告的 Bug 在最新版本中可以重现. (部分 Bug 可能已经在最近的代码中修复)
  • 已在 Issues 中搜索了相关的关键词
  • 不是 ant design vue 组件库的 Bug

描述 Bug

在使用国际化时,静态国际化文件没有问题,当调用后台请求时,访问页面一直停留在启动画面,浏览器中的console显示错误:ReferenceError: Cannot access 't' before initialization

复现 Bug

获取版本为:2.11.4的代码,修改文件setupI18n.ts中的代码,修改代码如下:
在19行:const message = defaultLocal.default?.message ?? {};下面添加以下代码:
let routeList: AppRouteRecordRaw[] = (await getMenuList()) as AppRouteRecordRaw[];

使用mock方式启动项目,在浏览器访问就会报错:ReferenceError: Cannot access 't' before initialization。
去掉这个请求就可以正常。

系统信息

  • 操作系统: window 10
  • Node 版本: v22.0.0
  • pnpm 版本: v9.1.0
@lijian3828940
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants