-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: vue2角色模块优化 * fix: 删除console * fix: 检视意见修改
- Loading branch information
Showing
12 changed files
with
242 additions
and
88 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/toolkits/pro/template/tinyvue2/src/api/permission.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/toolkits/pro/template/tinyvue2/src/hooks/useDisclosure.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ref } from 'vue'; | ||
|
||
export const useDisclosure = () => { | ||
const open = ref(false); | ||
const onClose = () => (open.value = false); | ||
const onOpen = () => (open.value = true); | ||
return { | ||
open, | ||
onClose, | ||
onOpen, | ||
}; | ||
}; |
16 changes: 16 additions & 0 deletions
16
packages/toolkits/pro/template/tinyvue2/src/hooks/useI18nMenu.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { ITreeNodeData } from '@/router/guard/menu'; | ||
import type { Composer } from 'vue-i18n-composable'; | ||
|
||
export const useI18nMenu = (data: ITreeNodeData[], t: Composer['t']) => { | ||
const menus: ITreeNodeData[] = [...data]; | ||
const dfs = (menu: ITreeNodeData) => { | ||
menu.label = t(menu.locale).toString(); | ||
for (const item of menu.children ?? []) { | ||
dfs(item); | ||
} | ||
}; | ||
for (const menu of data) { | ||
dfs(menu); | ||
} | ||
return menus; | ||
}; |
15 changes: 15 additions & 0 deletions
15
packages/toolkits/pro/template/tinyvue2/src/hooks/useMenuId.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { ITreeNodeData } from '@/router/guard/menu'; | ||
|
||
export const useMenuId = (datas: ITreeNodeData[]) => { | ||
const ids: any[] = []; | ||
const dfs = (menu: ITreeNodeData) => { | ||
ids.push(menu.id); | ||
for (const child of menu.children ?? []) { | ||
dfs(child); | ||
} | ||
}; | ||
for (const data of datas) { | ||
dfs(data); | ||
} | ||
return ids; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.