Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.CadastralSystem
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d28764c3
authored
2020-10-21 09:25:44 +0800
by
杨威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
处理store数据在页面刷新后丢失问题
1 parent
c579ca83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
src/App.vue
src/store/index.js
src/App.vue
View file @
d28764c
<
template
>
<div
id=
"app"
>
<router-view
/>
</div>
<div
id=
"app"
>
<router-view
/>
</div>
</
template
>
<
script
>
export
default
{
mounted
()
{
window
.
addEventListener
(
"unload"
,
this
.
saveState
);
},
methods
:
{
saveState
()
{
sessionStorage
.
setItem
(
"state"
,
JSON
.
stringify
(
this
.
$store
.
state
));
},
},
};
</
script
>
...
...
src/store/index.js
View file @
d28764c
...
...
@@ -8,7 +8,7 @@ import setTabs from './modules/setTabs'
Vue
.
use
(
Vuex
)
const
store
=
new
Vuex
.
Store
({
state
:
{
state
:
sessionStorage
.
getItem
(
'state'
)
?
JSON
.
parse
(
sessionStorage
.
getItem
(
'state'
)):
{
zdbsm
:
''
,
xzqList
:[],
djqList
:[],
...
...
Please
register
or
sign in
to post a comment