Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
credit
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
niuyutian
credit
Commits
3ddba9ae
Commit
3ddba9ae
authored
Aug 29, 2023
by
sunguoshu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加路由类型
parent
4ded0327
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
app.ts
src/store/modules/app.ts
+10
-4
index.d.ts
typings/apis/index.d.ts
+1
-1
No files found.
src/store/modules/app.ts
View file @
3ddba9ae
...
...
@@ -33,9 +33,15 @@ export const useAppStore = defineStore('app', () => {
authRoutes
.
push
(
i
.
path
!
)
return
{
...
obj
,
path
:
i
.
path
}
}
if
(
i
.
type
===
'dir'
)
{
return
{
...
obj
,
children
:
transformToMenu
(
i
.
children
??
[])
children
:
transformToMenu
(
i
.
children
??
[]).
filter
((
i
)
=>
i
)
}
}
if
(
i
.
type
===
'route'
)
{
authRoutes
.
push
(
i
.
path
!
)
return
null
}
})
}
...
...
@@ -67,7 +73,7 @@ export const useAppStore = defineStore('app', () => {
}
function
setMenu
(
data
:
any
[])
{
const
menu
=
transformToMenu
(
data
)
const
menu
=
transformToMenu
(
data
)
.
filter
((
i
)
=>
i
)
menuStore
.
setMenu
(
menu
)
}
...
...
typings/apis/index.d.ts
View file @
3ddba9ae
...
...
@@ -33,7 +33,7 @@ declare global {
/**
* @title 菜单类型
*/
type
:
'dir'
|
'menu'
type
:
'dir'
|
'menu'
|
'route'
}
export
type
User
=
{
...
...
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