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

[Feature Request] @@/core/history 增加对 basename 的导出 #12540

Closed
purple-force opened this issue Jul 5, 2024 · 2 comments
Closed

[Feature Request] @@/core/history 增加对 basename 的导出 #12540

purple-force opened this issue Jul 5, 2024 · 2 comments

Comments

@purple-force
Copy link

purple-force commented Jul 5, 2024

Background

在写一个通用的响应拦截器插件,在登录失效情况下,原先是用 history.push 到本工程内的 '/login' 路由页面。现在需要新打开独立的登录页,在存在路由前缀(.umirc.ts 中配置 base)、微前端子应用等场景下,没有 basename,无法拼接完整的跳转链接

Proposal

export { history }; 这里增加 basename 的导出。这样在自定义插件中即可通过 import { basename } from '@@/core/history' 获取 basename

Additional context

Add any other context or screenshots about the feature request here.

@fz6m
Copy link
Member

fz6m commented Jul 6, 2024

需要配置文件配置的 base 值的话,比较好的方式是在配置文件里把这个值用 define 注入,之后项目里通过 process.env.XXX 使用。

@fz6m fz6m closed this as completed Jul 6, 2024
@purple-force
Copy link
Author

需要配置文件配置的 base 值的话,比较好的方式是在配置文件里把这个值用 define 注入,之后项目里通过 process.env.XXX 使用。

子应用场景下呢?需要用 父应用 base + 子应用前缀,规则可能有很多,而从 history 里导出则比较直接。

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