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

页面刷新,不要关闭某个路由 #2445

Open
DazhiFe opened this issue Aug 6, 2019 · 7 comments
Open

页面刷新,不要关闭某个路由 #2445

DazhiFe opened this issue Aug 6, 2019 · 7 comments

Comments

@DazhiFe
Copy link

DazhiFe commented Aug 6, 2019

作者,你好,首先非常感谢你开源了这么好的框架!

现在有个问题:打开了很多个路由页面,点击浏览器的刷新按钮,怎么让某个路由不要关闭,比如首页?

我现在的情况是:打开了多个路由后,一刷新浏览器,只会保留那个active的路由,其他都会关闭掉,包括我首页设置了固钉也会被关闭,但是我看了你线上的完整预览版,刷新后首页跟文档都不会被关闭。

麻烦您有空的时候看下,感谢!

@hedekun
Copy link

hedekun commented Aug 6, 2019

因为刷新的时候vuex里的数据丢失了。把@/store/modules/tagsView中的state在浏览器sessionstage中存一份。

@DazhiFe
Copy link
Author

DazhiFe commented Aug 7, 2019

@hedekun 我下载了完整版的代码,作者也没有存到sessionStorage,但是不管页面怎么刷新,首页跟文档页始终不会被关闭。我是下载那个基础模板,然后自己添加了tagsView进去

@hedekun
Copy link

hedekun commented Aug 7, 2019

@DazhiFe 你需要持续保持的话,在@/router中的meta字段中添加affix: true就可以了。实现的逻辑在@/layout/compoents/TagsView/index.vue。逻辑也是添加到已经访问的tagsView里。

@wubianluoye
Copy link

src/permission.js 改动在if(hasGetUserInfo)这一块,对着 admin的模板改就行了。。。我也找了好久-.-!

@DazhiFe
Copy link
Author

DazhiFe commented Aug 8, 2019

@hedekun affix: true 这个有加了哦,我试下 @wubianluoye 说的,谢谢你。

@bochoi
Copy link

bochoi commented Aug 8, 2019

我也是这个问题困扰了好久都没解决

@zhengjf1988
Copy link

打开的页面,一刷新除了当前页面都会被关闭,如果我不想关闭打开的页面应该怎么设置呀?

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

5 participants