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

[Bug] umi3和umi4 history.location.pathname和history.location.createHref方法在设置了base后表现不一致 #11904

Closed
wenlei0617 opened this issue Nov 25, 2023 · 2 comments

Comments

@wenlei0617
Copy link

文档中umi3升级到umi4中并没有提到history方法做了修改,导致以下行为完全不一致了。这应该是升级bug?为什么要修改呢?

// umi3 base 配置 /template
history.createHref({ pathname: '/test' }); // 打印为 /template/test
// 当前路径为/template/test时
history.location.pathname; // 打印为 /test

// umi4 base 配置 /template
history.createHref({ pathname: '/test' }); // 打印为 /test
// 当前路径为/template/test时
history.location.pathname; // 打印为 /template/test

Context

  • Umi Version: 4.0.88
  • Node Version: 16
  • Platform: mac
Copy link

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2023
@fz6m
Copy link
Contributor

fz6m commented Nov 26, 2023

参考 #10849 (comment) ,自行替换下使用的地方代码即可,目前 react router v6 的设计是全 hooks 式的,是大势所趋,应该尽早摆脱对 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