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

路由上的hook怎么加 #30

Closed
liSong5713 opened this issue Aug 24, 2017 · 5 comments
Closed

路由上的hook怎么加 #30

liSong5713 opened this issue Aug 24, 2017 · 5 comments

Comments

@liSong5713
Copy link

mirrorx用的是rr4 ,但是没有暴露rr4的hook,请问怎么引入?

@llh911001
Copy link
Member

指的是 onEnter 等 hook ?rr4 已经没有这些 hook 了呀

@liSong5713
Copy link
Author

mirrorx 只暴露了
Route Switch Redirect Link NavLink
,prompt还没有暴露。

@llh911001
Copy link
Member

llh911001 commented Aug 25, 2017

我们当时认为实现这种跳转前确认的功能,使用 shouldComponentUpdate 生命周期方法就行了,所以就没有暴露 Prompt(基于类似的考虑,我们也没有暴露 withRouter)。

不过假如你确实有需要的话,我们会在近期的发布中加上。

另外要注意的是,如果你不想使用默认的 window.prompt,那么你需要自己指定一下 getUserConfirmation

@liSong5713
Copy link
Author

shouldComponentUpdate也可以实现,但是在语义和便捷度上,Prompt可能更好些!

@llh911001
Copy link
Member

已经加上了。谢谢建议!

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