mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-21 18:57:08 +08:00
feat: 新增角色管理
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export * from './useMenu'
|
||||
export * from './useDept'
|
||||
export * from './useRole'
|
||||
export * from './useDict'
|
||||
|
21
src/hooks/app/useMenu.ts
Normal file
21
src/hooks/app/useMenu.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ref } from 'vue'
|
||||
import { listMenuTree } from '@/apis'
|
||||
import type { TreeNodeData } from '@arco-design/web-vue'
|
||||
|
||||
/** 菜单模块 */
|
||||
export function useMenu(options?: { onSuccess?: () => void }) {
|
||||
const loading = ref(false)
|
||||
const menuList = ref<TreeNodeData[]>([])
|
||||
|
||||
const getMenuList = async (name?: string) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await listMenuTree({ description: name })
|
||||
menuList.value = res.data
|
||||
options?.onSuccess && options.onSuccess()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
return { menuList, getMenuList, loading }
|
||||
}
|
Reference in New Issue
Block a user