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

SPA上的问题 #28

Open
CrazyCoderShi opened this issue Apr 11, 2017 · 2 comments
Open

SPA上的问题 #28

CrazyCoderShi opened this issue Apr 11, 2017 · 2 comments

Comments

@CrazyCoderShi
Copy link

我目前也在封装webView(WKWebView)相关的东西
在封装的过程中,发现,如果web页面是使用SPA(Vue.js, React, Angluar.js等)方式来做的,那么就会造成backForwardList(返回栈)紊乱的问题,这会导致,用户在点击返回按钮来执行goBack的时候,会出现多1-2个栈
希望repo主一起研究
我目前的解决方式是:

  1. 通过KVO的方式来observe每个页面的title,并且在对应的.h开放indexTitle属性

2.如webView.title == indexTitle,这个时候让返回按钮执行popAction

3.反之,执行goBackAction

@devedbox
Copy link
Owner

@CrazyCoderShi 我也遇到过这个问题,但是没怎么关注,毕竟web环境不是单一的,我目前的解决方法是尽量避免这个问题,在我的项目中基本很少使用SPA。你的这个解决方案,有没有什么隐患呢?

@CrazyCoderShi
Copy link
Author

@devedbox
目前来说,没有发现问题
我是觉得这样的方式,是不是太low了,想着你们可能有更好的解决方案😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants