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

可以添加F5刷新后保持tab吗 #12

Closed
simplast opened this issue Mar 22, 2021 · 10 comments · Fixed by #14
Closed

可以添加F5刷新后保持tab吗 #12

simplast opened this issue Mar 22, 2021 · 10 comments · Fixed by #14
Assignees
Labels
enhancement New feature or request

Comments

@simplast
Copy link

No description provided.

@yunsii
Copy link
Owner

yunsii commented Mar 23, 2021

保持 tab 是指的 F5 刷新之后恢复到上次的 tab 状态?如果是这样的话,具体的使用场景是什么呢?因为现在本来就有针对单个 tab 的刷新功能的。

@simplast
Copy link
Author

可能用户习惯用F5,刷新后标签页能不能继续保持以前的状态。

@yunsii
Copy link
Owner

yunsii commented Mar 23, 2021

可能用户习惯用F5,刷新后标签页能不能继续保持以前的状态。

这样有个问题,如果已经打开了很多 tab,那么刷新之后恢复的话,那一瞬间请求大概率很多。个人觉得还是用户重新打开相关页面更合适一些。

@yunsii
Copy link
Owner

yunsii commented Mar 23, 2021

或者说假装打开上次的 tab,切过去再渲染出来?有这个特性的话那就会一直恢复上次打开的 tab 了,毕竟不知道用户是刷新还是关闭页面。

@simplast
Copy link
Author

是的,假装。F5其实只会拿到F5前激活的tab,其余的没有内容

@yunsii
Copy link
Owner

yunsii commented Mar 23, 2021

https://stackoverflow.com/questions/11453741/javascript-beforeunload-detect-refresh-versus-close 看了一下这个,刷新应该是能尽可能的知道,如果是通过按键的方式的话。这个功能挺有意思的,我争取这周搞定。

@yunsii yunsii added the enhancement New feature or request label Mar 23, 2021
@simplast
Copy link
Author

simplast commented Mar 23, 2021

如果直接去改tab数据来源,把来源直接存到sessionStorage里面,会不会更方便一点,渲染tab都是依靠本地存储的数据,那就可以不用在刷新前后写额外逻辑了。

@yunsii
Copy link
Owner

yunsii commented Mar 23, 2021

如果直接去改tab数据来源,把来源直接存到sessionStorage里面,会不会更方便一点,渲染tab都是依靠本地存储的数据,那就可以不用在刷新前后写额外逻辑了。

计划还是给个配置,假装打开也需要额外的逻辑来阻止页面渲染的啊,不然恢复了发送的请求可能太多了,当然也可以给个配置不阻止 😂

@yunsii
Copy link
Owner

yunsii commented Mar 31, 2021

今天得空考虑了一下具体实现,核心逻辑都得改造一下,争取清明假期结束前搞定吧 😂

@yunsii yunsii linked a pull request May 15, 2021 that will close this issue
@yunsii yunsii added this to the 标签页状态持久化 milestone May 15, 2021
@yunsii yunsii self-assigned this May 15, 2021
@yunsii yunsii pinned this issue May 15, 2021
@yunsii
Copy link
Owner

yunsii commented May 15, 2021

抽空解决了,可以看看在线实例的效果

@yunsii yunsii closed this as completed May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants