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

页面标题从接口异步获取,pageveiw需要上报该信息,请问有思路实现吗? #53

Open
huyong007 opened this issue Jan 9, 2022 · 2 comments

Comments

@huyong007
Copy link

No description provided.

@otakustay
Copy link
Member

如果数据在组件外部取到的话,自己实现个Provider(内部调用现成的Provider)就行。如果数据在组件内部拿的话,要拆组件了:

<Route path="xxx"
  <TitleProvider> <-- 在这里异步拿标题,往下传
    <MyTrackRoute path="xxx"> <-- 和上面的Route一样的path,但它能拿到TitleProvider给的,然后再渲染TrackRoute

确实比较麻烦,不过好像react-track的实现也没法支持异步(除非suspense)

@huyong007
Copy link
Author

suspense 是不是对业务代码有侵入性?现在用的MutationObserver 进行面包屑的dom监控

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