diff --git a/src/components/ConfigGlobal/index.ts b/src/components/ConfigGlobal/index.ts index dda2462..eaeb7d0 100644 --- a/src/components/ConfigGlobal/index.ts +++ b/src/components/ConfigGlobal/index.ts @@ -1,3 +1,5 @@ import ConfigGlobal from './src/ConfigGlobal.vue' +export type { ConfigGlobalTypes } from './src/types' + export { ConfigGlobal } diff --git a/src/components/ContextMenu/index.ts b/src/components/ContextMenu/index.ts index 2a7c1f0..1b5442d 100644 --- a/src/components/ContextMenu/index.ts +++ b/src/components/ContextMenu/index.ts @@ -2,6 +2,8 @@ import ContextMenu from './src/ContextMenu.vue' import { ElDropdown } from 'element-plus' import type { RouteLocationNormalizedLoaded } from 'vue-router' +export type { ContextMenuSchema } from './src/types' + export interface ContextMenuExpose { elDropdownMenuRef: ComponentRef tagItem: RouteLocationNormalizedLoaded diff --git a/src/components/ContextMenu/src/ContextMenu.vue b/src/components/ContextMenu/src/ContextMenu.vue index ddba8be..9583037 100644 --- a/src/components/ContextMenu/src/ContextMenu.vue +++ b/src/components/ContextMenu/src/ContextMenu.vue @@ -4,7 +4,7 @@ import { PropType, ref } from 'vue' import { useI18n } from '@/hooks/web/useI18n' import { useDesign } from '@/hooks/web/useDesign' import type { RouteLocationNormalizedLoaded } from 'vue-router' -import { contextMenuSchema } from './types' +import { ContextMenuSchema } from './types' const { getPrefixCls } = useDesign() const prefixCls = getPrefixCls('context-menu') @@ -15,7 +15,7 @@ const emit = defineEmits(['visibleChange']) const props = defineProps({ schema: { - type: Array as PropType, + type: Array as PropType, default: () => [] }, trigger: { @@ -28,7 +28,7 @@ const props = defineProps({ } }) -const command = (item: contextMenuSchema) => { +const command = (item: ContextMenuSchema) => { item.command && item.command(item) } diff --git a/src/components/ContextMenu/src/types/index.ts b/src/components/ContextMenu/src/types/index.ts index 0738d0e..b2be72b 100644 --- a/src/components/ContextMenu/src/types/index.ts +++ b/src/components/ContextMenu/src/types/index.ts @@ -1,7 +1,7 @@ -export type contextMenuSchema = { +export interface ContextMenuSchema { disabled?: boolean divided?: boolean icon?: string label: string - command?: (item: contextMenuSchema) => void + command?: (item: ContextMenuSchema) => void } diff --git a/src/components/Descriptions/index.ts b/src/components/Descriptions/index.ts index 91b0eb4..8f9a0f0 100644 --- a/src/components/Descriptions/index.ts +++ b/src/components/Descriptions/index.ts @@ -1,3 +1,5 @@ import Descriptions from './src/Descriptions.vue' +export type { DescriptionsSchema } from './src/types' + export { Descriptions } diff --git a/src/components/Descriptions/src/Descriptions.vue b/src/components/Descriptions/src/Descriptions.vue index a9948d1..ef5fd6b 100644 --- a/src/components/Descriptions/src/Descriptions.vue +++ b/src/components/Descriptions/src/Descriptions.vue @@ -1,130 +1,135 @@ - + const toggleClick = () => { + if (props.collapse) { + show.value = !unref(show) + } + } - + +
+ + {{ + extra: () => (slots['extra'] ? slots['extra']() : props.extra), + default: () => { + return props.schema.map((item) => { + return ( + + {{ + label: () => (item.slots?.label ? item.slots?.label(item) : item.label), + default: () => + item.slots?.default + ? item.slots?.default(item) + : props.data[item.field] + }} + + ) + }) + } + }} + +
+
+ + ) + } + } +}) +