Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-3
Overview
Overview
Details
Activity
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
office
haoban-3
Commits
4be3b1a0
Commit
4be3b1a0
authored
Aug 08, 2022
by
caoyanzhi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/act-code' into dev
parents
6c9beec8
be1659e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
30 deletions
+28
-30
index.vue
src/components/layout/index.vue
+28
-30
No files found.
src/components/layout/index.vue
View file @
4be3b1a0
...
@@ -26,33 +26,6 @@ export default {
...
@@ -26,33 +26,6 @@ export default {
name
:
'DmHbLayout'
,
name
:
'DmHbLayout'
,
components
:
{
Notice
,
MainMenu
,
AsideMenu
,
BreadMenu
},
components
:
{
Notice
,
MainMenu
,
AsideMenu
,
BreadMenu
},
provide
:
()
=>
provideData
,
provide
:
()
=>
provideData
,
beforeRouteUpdate
(
to
,
from
,
next
)
{
if
(
Array
.
isArray
(
to
.
meta
.
fromPath
))
{
const
isKeepAlive
=
to
.
meta
.
fromPath
.
some
(
el
=>
{
let
menuUrlReg
=
el
;
let
pathConfigReg
=
/
(
:.*
)(\/?)
/
;
const
pathRegStr
=
'([
\\
d
\\
w]+[
\\
-]*[
\\
d
\\
w]*)'
;
while
(
pathConfigReg
.
test
(
menuUrlReg
))
{
menuUrlReg
=
menuUrlReg
.
replace
(
pathConfigReg
,
`
${
pathRegStr
}
$2`
);
}
pathConfigReg
=
/
(\/\*)(\/?)
/
;
while
(
pathConfigReg
.
test
(
menuUrlReg
))
{
menuUrlReg
=
menuUrlReg
.
replace
(
pathConfigReg
,
`
${
pathRegStr
}
$2`
);
}
const
reg
=
new
RegExp
(
`^
${
menuUrlReg
}
$`
);
return
reg
.
test
(
from
.
path
);
});
if
(
!
isKeepAlive
)
{
this
.
keepAlive
=
this
.
keepAlive
.
filter
(
el
=>
el
!=
to
.
meta
.
componentName
);
}
setTimeout
(()
=>
{
if
(
this
.
keepAlive
.
every
(
el
=>
el
!=
to
.
meta
.
componentName
))
{
this
.
keepAlive
.
push
(
to
.
meta
.
componentName
);
}
},
100
);
}
next
();
},
props
:
{
props
:
{
// 菜单树数据
// 菜单树数据
menuList
:
{
menuList
:
{
...
@@ -92,11 +65,10 @@ export default {
...
@@ -92,11 +65,10 @@ export default {
}
}
},
},
created
()
{
created
()
{
if
(
Array
.
isArray
(
this
.
$route
.
meta
.
fromPath
))
{
this
.
setKeepAlive
(
this
.
$route
,
{});
this
.
keepAlive
.
push
(
this
.
$route
.
meta
.
componentName
);
}
this
.
$router
.
beforeEach
((
to
,
from
,
next
)
=>
{
this
.
$router
.
beforeEach
((
to
,
from
,
next
)
=>
{
this
.
activedMenu
=
this
.
getActivedMenu
(
this
.
getMenuByPath
(
to
.
path
.
slice
(
1
)));
this
.
activedMenu
=
this
.
getActivedMenu
(
this
.
getMenuByPath
(
to
.
path
.
slice
(
1
)));
this
.
setKeepAlive
(
to
,
from
);
next
();
next
();
});
});
provideData
.
layoutVm
=
this
;
provideData
.
layoutVm
=
this
;
...
@@ -145,6 +117,32 @@ export default {
...
@@ -145,6 +117,32 @@ export default {
getMenuByPath
(
path
)
{
getMenuByPath
(
path
)
{
return
this
.
pageRight
.
find
(
el
=>
el
.
regexp
.
test
(
'/'
+
path
))
||
{};
return
this
.
pageRight
.
find
(
el
=>
el
.
regexp
.
test
(
'/'
+
path
))
||
{};
},
},
setKeepAlive
(
to
,
from
)
{
if
(
Array
.
isArray
(
to
.
meta
.
fromPath
))
{
const
isKeepAlive
=
to
.
meta
.
fromPath
.
some
(
el
=>
{
let
menuUrlReg
=
el
;
let
pathConfigReg
=
/
(
:.*
)(\/?)
/
;
const
pathRegStr
=
'([
\\
d
\\
w]+[
\\
-]*[
\\
d
\\
w]*)'
;
while
(
pathConfigReg
.
test
(
menuUrlReg
))
{
menuUrlReg
=
menuUrlReg
.
replace
(
pathConfigReg
,
`
${
pathRegStr
}
$2`
);
}
pathConfigReg
=
/
(\/\*)(\/?)
/
;
while
(
pathConfigReg
.
test
(
menuUrlReg
))
{
menuUrlReg
=
menuUrlReg
.
replace
(
pathConfigReg
,
`
${
pathRegStr
}
$2`
);
}
const
reg
=
new
RegExp
(
`^
${
menuUrlReg
}
$`
);
return
reg
.
test
(
from
.
path
);
});
if
(
!
isKeepAlive
)
{
this
.
keepAlive
=
this
.
keepAlive
.
filter
(
el
=>
el
!=
to
.
meta
.
componentName
);
}
setTimeout
(()
=>
{
if
(
this
.
keepAlive
.
every
(
el
=>
el
!=
to
.
meta
.
componentName
))
{
this
.
keepAlive
.
push
(
to
.
meta
.
componentName
);
}
},
100
);
}
},
onShowLoading
(
loading
)
{
onShowLoading
(
loading
)
{
if
(
loading
)
{
if
(
loading
)
{
this
.
fullLoading
.
visible
=
true
;
this
.
fullLoading
.
visible
=
true
;
...
...
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