Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
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
Administrator
bkunyun
Commits
f10e4896
Commit
f10e4896
authored
Oct 19, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 路由修改
parent
6704e629
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
useMyRouter.ts
src/components/MyRouter/useMyRouter.ts
+12
-4
index.tsx
src/views/MenuLayout/index.tsx
+2
-1
index.tsx
...ceCenter/UserResources/UserResourcesEnvironment/index.tsx
+1
-3
No files found.
src/components/MyRouter/useMyRouter.ts
View file @
f10e4896
...
...
@@ -43,18 +43,26 @@ const useMyRouter = () => {
});
}
for
(
let
item
of
menuInfo
.
res
.
data
)
{
let
childrenRoutes
:
any
=
[]
for
(
let
route
of
item
.
routes
)
{
route
.
element
=
elements
[
route
.
element
]
||
NotFound
;
route
.
path
=
`/product/
${
item
.
id
}${
route
.
path
}
`
;
if
(
Array
.
isArray
(
route
.
children
))
{
route
.
children
.
forEach
((
childrenItem
:
any
,
index
:
number
)
=>
{
route
.
children
[
index
].
element
=
elements
[
childrenItem
.
element
]
||
NotFound
;
route
.
children
[
index
].
path
=
`
${
route
.
path
}${
childrenItem
.
path
}
`
;
if
(
childrenItem
.
path
)
{
childrenRoutes
.
push
({
...
childrenItem
,
element
:
elements
[
childrenItem
.
element
]
||
NotFound
,
path
:
`
${
route
.
path
}${
childrenItem
.
path
}
`
,
show
:
false
})
}
})
route
.
children
=
route
.
children
.
filter
((
childrenItem
:
any
)
=>
!
childrenItem
.
path
)
}
}
console
.
log
(
item
.
routes
)
permissionStore
.
setAddRoutes
(
item
.
routes
);
// permissionStore.setAddRoutes(item.routes);
permissionStore
.
setAddRoutes
(
[...
childrenRoutes
,
...
item
.
routes
]
);
}
menuStore
.
initMenu
(
menuInfo
.
res
.
data
);
permissionStore
.
initAllRoutes
();
...
...
src/views/MenuLayout/index.tsx
View file @
f10e4896
...
...
@@ -85,7 +85,8 @@ const MenuLayout = observer(() => {
key=
{
"sidebar"
+
index
}
className=
{
classnames
({
[
style
.
listItem
]:
true
,
[
style
.
active
]:
`/v3${item.path}`
===
pathname
,
[
style
.
active
]:
pathname
.
indexOf
(
`/v3${item.path}`
)
!==
-
1
,
// [style.active]: `/v3$
{
item
.
path
}
` === pathname,
})
}
style=
{
`/v3${item.path}`
===
pathname
...
...
src/views/ResourceCenter/UserResources/UserResourcesEnvironment/index.tsx
View file @
f10e4896
...
...
@@ -132,9 +132,7 @@ const UserResourcesEnvironment = () => {
const
hanleToSeeEnv
=
(
item
:
any
)
=>
{
console
.
log
(
"hanleToSeeEnv"
);
console
.
log
(
item
.
id
);
// /product/userCenter/userInformation
// navigate("/product/resourceCenter/userResources/seeEnv", {
navigate
(
"/product/userCenter/userInformation"
,
{
navigate
(
"/product/resourceCenter/userResources/seeEnv"
,
{
state
:
{
id
:
item
.
id
},
});
};
...
...
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