mirror of
				https://github.com/continew-org/continew-admin-ui.git
				synced 2025-10-31 22:57:15 +08:00 
			
		
		
		
	chore: 优化部分代码
This commit is contained in:
		| @@ -37,11 +37,6 @@ const defaultConfig = { | ||||
| const config = defaultConfig | ||||
|  | ||||
| const codeValue = computed(() => props.codeJson) | ||||
| const visible = ref(false) | ||||
| // 打开 | ||||
| const open = () => { | ||||
|   visible.value = true | ||||
| } | ||||
|  | ||||
| const extensions = computed(() => { | ||||
|   const arr = [isDark.value ? oneDark : githubLight] | ||||
| @@ -53,8 +48,6 @@ const extensions = computed(() => { | ||||
|   } | ||||
|   return arr | ||||
| }) | ||||
|  | ||||
| defineExpose({ open }) | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|   | ||||
| @@ -33,9 +33,9 @@ const iconSize = computed<string | number>(() => { | ||||
|   return getUnitValue(props.size) | ||||
| }) | ||||
|  | ||||
| const iconName = computed<string>(() => `#icon-${props.name}`) | ||||
| const iconName = computed(() => `#icon-${props.name}`) | ||||
|  | ||||
| const svgClass = computed<string>(() => { | ||||
| const svgClass = computed(() => { | ||||
|   if (props.name) return `svg-icon icon-${props.name}` | ||||
|   return 'svg-icon' | ||||
| }) | ||||
|   | ||||
| @@ -3,8 +3,8 @@ import { Message, Modal } from '@arco-design/web-vue' | ||||
| import type { Options as paginationOptions } from './usePagination' | ||||
| import { usePagination } from '@/hooks' | ||||
|  | ||||
| interface Options<T> { | ||||
|   formatResult?: (data: T[]) => any | ||||
| interface Options<T, U> { | ||||
|   formatResult?: (data: T[]) => U[] | ||||
|   onSuccess?: () => void | ||||
|   immediate?: boolean | ||||
|   rowKey?: keyof T | ||||
| @@ -14,11 +14,11 @@ interface Options<T> { | ||||
| type PaginationParams = { page: number, size: number } | ||||
| type Api<T> = (params: PaginationParams) => Promise<ApiRes<PageRes<T[]>>> | Promise<ApiRes<T[]>> | ||||
|  | ||||
| export function useTable<T>(api: Api<T>, options?: Options<T>) { | ||||
| export function useTable<T extends U, U = T>(api: Api<T>, options?: Options<T, U>) { | ||||
|   const { formatResult, onSuccess, immediate, rowKey } = options || {} | ||||
|   const { pagination, setTotal } = usePagination(() => getTableData(), options?.paginationOption) | ||||
|   const loading = ref(false) | ||||
|   const tableData = ref<T[]>([]) | ||||
|   const tableData: Ref<U[]> = ref([]) | ||||
|  | ||||
|   async function getTableData() { | ||||
|     try { | ||||
|   | ||||
| @@ -13,8 +13,8 @@ const storeSetup = () => { | ||||
|   // 深色菜单主题色变量 | ||||
|   const themeCSSVar = computed<Record<string, string>>(() => { | ||||
|     const obj: Record<string, string> = {} | ||||
|     const list = generate(settingConfig.themeColor, { list: true, dark: true }) | ||||
|     list.forEach((color: string, index: number) => { | ||||
|     const list = generate(settingConfig.themeColor, { list: true, dark: true }) as string[] | ||||
|     list.forEach((color, index) => { | ||||
|       obj[`--primary-${index + 1}`] = getRgbStr(color) | ||||
|     }) | ||||
|     return obj | ||||
| @@ -24,8 +24,8 @@ const storeSetup = () => { | ||||
|   const setThemeColor = (color: string) => { | ||||
|     if (!color) return | ||||
|     settingConfig.themeColor = color | ||||
|     const list = generate(settingConfig.themeColor, { list: true, dark: settingConfig.theme === 'dark' }) | ||||
|     list.forEach((color: string, index: number) => { | ||||
|     const list = generate(settingConfig.themeColor, { list: true, dark: settingConfig.theme === 'dark' }) as string[] | ||||
|     list.forEach((color, index) => { | ||||
|       const rgbStr = getRgbStr(color) | ||||
|       document.body.style.setProperty(`--primary-${index + 1}`, rgbStr) | ||||
|     }) | ||||
|   | ||||
							
								
								
									
										7
									
								
								src/types/components.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								src/types/components.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -8,13 +8,6 @@ export {} | ||||
| declare module 'vue' { | ||||
|   export interface GlobalComponents { | ||||
|     Breadcrumb: typeof import('./../components/Breadcrumb/index.vue')['default'] | ||||
|     CrontabDay: typeof import('./../components/CornTab/CrontabDay.vue')['default'] | ||||
|     CrontabField: typeof import('./../components/CornTab/CrontabField.vue')['default'] | ||||
|     CrontabGenerator: typeof import('./../components/CornTab/CrontabGenerator.vue')['default'] | ||||
|     CrontabModel: typeof import('./../components/CornTab/CrontabModel.vue')['default'] | ||||
|     CrontabMonth: typeof import('./../components/CornTab/CrontabMonth.vue')['default'] | ||||
|     CrontabWeek: typeof import('./../components/CornTab/CrontabWeek.vue')['default'] | ||||
|     CrontabYear: typeof import('./../components/CornTab/CrontabYear.vue')['default'] | ||||
|     DateRangePicker: typeof import('./../components/DateRangePicker/index.vue')['default'] | ||||
|     GiCellAvatar: typeof import('./../components/GiCell/GiCellAvatar.vue')['default'] | ||||
|     GiCellGender: typeof import('./../components/GiCell/GiCellGender.vue')['default'] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user