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

Outlet context 和 useKeepOutlets 如何共用 #647

Open
mgserss opened this issue Apr 10, 2024 · 5 comments
Open

Outlet context 和 useKeepOutlets 如何共用 #647

mgserss opened this issue Apr 10, 2024 · 5 comments

Comments

@mgserss
Copy link

mgserss commented Apr 10, 2024

有个页面既需要页面缓存,又需要层级传递数据,该如何实现

@xiaohuoni
Copy link
Member

没理解问题,你就把 useKeepOutlets 当 Outlet 使用,不能满足吗 ?

@mgserss
Copy link
Author

mgserss commented Apr 15, 2024

没理解问题,你就把 useKeepOutlets 当 Outlet 使用,不能满足吗 ?

Outlet 组件可以传递context,比如<Outlet context={{ prop: 'from Layout'}} />,useKeepOutlets 可以支持context传递吗?

@mgserss
Copy link
Author

mgserss commented Apr 15, 2024

用了useKeepOutlets 后,我需要在哪里注入context

@xiaohuoni
Copy link
Member

不理解你要做什么,可以给一个 demo
我的习惯自己需要 context 应该自己再搞一层?而不是通过 Outlet 传递?没这么用过有什么“小技巧”吗?

@mgserss
Copy link
Author

mgserss commented Apr 18, 2024

不理解你要做什么,可以给一个 demo 我的习惯自己需要 context 应该自己再搞一层?而不是通过 Outlet 传递?没这么用过有什么“小技巧”吗?

image
就比如图里,我在layout index 中设置了一个全局loading,这样子页面都可以直接用,但是某些页面例如列表页需要用到keep-alive功能,但是也需要loading,所以不能同时在index里面实现,需要套多一层吗?

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