diff --git a/mock/MockMenus.js b/mock/MockMenus.js index acde6be..c9695e1 100644 --- a/mock/MockMenus.js +++ b/mock/MockMenus.js @@ -78,7 +78,7 @@ const allMenus = [ { id: 25, parentId: 2, - iconCls: 'PieChartSharp', + iconCls: 'PieChart', nameCn: '图表示例', nameEn: 'Charts', menuUrl: '/charts' diff --git a/src/components/common-descriptions/index.vue b/src/components/common-descriptions/index.vue new file mode 100644 index 0000000..02b7f3a --- /dev/null +++ b/src/components/common-descriptions/index.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/components/common-descriptions/public.d.ts b/src/components/common-descriptions/public.d.ts new file mode 100644 index 0000000..2f10b73 --- /dev/null +++ b/src/components/common-descriptions/public.d.ts @@ -0,0 +1,30 @@ +import { VNode } from 'vue' +import { descriptionItemProps } from 'element-plus/es/components/descriptions/src/description-item' + +export interface CommonDescriptionItem { + label?: string; + labelKey?: string; + value?: string; + span?: number; + width?: string; + minWidth?: string; + className?: string; + labelClassName?: string; + align?: 'left' | 'right' | 'center'; + labelAlign?: string; + slots?: any; + formatter?: (item: CommonDescriptionItem) => string | VNode; + attrs?: descriptionItemProps; +} + +export interface CommonDescriptionProps { + border?: boolean; + column?: number; + direction?: 'horizontal' | 'vertical'; + size?: 'default' | 'small' | 'large'; + title?: string; + extra?: string; + items?: Array; + width?: string; + minWidth?: string; +} diff --git a/src/components/common-form-control/control-child.vue b/src/components/common-form-control/control-child.vue index f91a86a..0118d16 100644 --- a/src/components/common-form-control/control-child.vue +++ b/src/components/common-form-control/control-child.vue @@ -48,11 +48,12 @@ const tooltipFunc = ($event) => { {{ label }} { return null }) +const slotsResult = computed(() => { + const results = {} + if (calcOption.value?.slots) { + const slots = calcOption.value.slots + for (const slotKey in slots) { + const slot = slots[slotKey] + if (isFunction(slot)) { + const slotResult = slot(modelValue.value, calcOption.value) + results[slotKey] = { + result: slotResult, + vnode: isVNode(slotResult) + } + } + } + } + return results +}) +