Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lxyl-vue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李苏
lxyl-vue
Commits
7ebf0329
Commit
7ebf0329
authored
Jun 05, 2024
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
还原
parent
445935fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
57 deletions
+8
-57
AppMain.vue
src/layout/components/AppMain.vue
+8
-57
No files found.
src/layout/components/AppMain.vue
View file @
7ebf0329
<
template
>
<
template
>
<section
class=
"app-main"
>
<section
class=
"app-main"
>
<keep-alive
>
<transition
name=
"fade-transform"
mode=
"out-in"
>
<router-view
v-show=
"isCache"
/>
<keep-alive
v-if=
"cachedViews.includes(key)"
>
<router-view
:key=
"key"
/>
</keep-alive>
</keep-alive>
<router-view
v-if=
"!isCache
"
/>
<router-view
v-else
:key=
"key
"
/>
</transition>
</section>
</section>
</
template
>
</
template
>
...
@@ -15,59 +16,9 @@ export default {
...
@@ -15,59 +16,9 @@ export default {
cachedViews
()
{
cachedViews
()
{
return
this
.
$store
.
state
.
tagsView
.
cachedViews
return
this
.
$store
.
state
.
tagsView
.
cachedViews
},
},
},
key
()
{
watch
:{
console
.
log
(
this
.
$route
.
name
)
isCache
(
val
){
return
this
.
$route
.
name
console
.
log
(
val
)
},
cachedViews
(
val
){
this
.
JSONcachedViews
=
JSON
.
stringify
(
val
)
},
JSONcachedViews
(
nv
,
ov
){
let
nvobj
=
JSON
.
parse
(
nv
)
let
ovobj
=
JSON
.
parse
(
ov
)
this
.
oldCachedViews
=
ovobj
if
(
nvobj
.
length
>
ovobj
.
length
){
this
.
addBz
=
true
}
else
{
this
.
addBz
=
false
}
},
$route
(
val
){
this
.
key
=
val
.
name
if
(
this
.
addBz
){
if
(
this
.
oldCachedViews
.
includes
(
val
.
name
)){
this
.
isCache
=
true
}
else
{
this
.
isCache
=
false
}
// if(this.oldCachedViews.includes(val.name)){
// this.isCache=true
// }else{
// this.isCache=false
// }
this
.
addBz
=
false
}
else
{
// this.isCache=true
if
(
this
.
cachedViews
.
includes
(
val
.
name
)){
console
.
log
(
'包含,进入缓存'
)
this
.
isCache
=
true
}
else
{
console
.
log
(
'不包含,不进入缓存'
)
this
.
isCache
=
false
}
// this.isCache=this.cachedViews.includes(val.name)
}
}
},
data
(){
return
{
isCache
:
true
,
JSONcachedViews
:
''
,
addBz
:
false
,
key
:
null
,
oldCachedViews
:[]
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment