Commit 6a542b61047ec3a26211751bf776314d244d87af

Authored by xingyu4j
1 parent 983a6369

perf: 优化描述组件

yudao-ui-admin-vue3/src/components/Descriptions/src/Descriptions.vue
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 import { ElCollapseTransition, ElDescriptions, ElDescriptionsItem, ElTooltip } from 'element-plus' 2 import { ElCollapseTransition, ElDescriptions, ElDescriptionsItem, ElTooltip } from 'element-plus'
3 import { useDesign } from '@/hooks/web/useDesign' 3 import { useDesign } from '@/hooks/web/useDesign'
4 import { propTypes } from '@/utils/propTypes' 4 import { propTypes } from '@/utils/propTypes'
5 -import { ref, unref, PropType, computed, useAttrs } from 'vue' 5 +import { ref, unref, PropType, computed, useAttrs, useSlots } from 'vue'
6 import { useAppStore } from '@/store/modules/app' 6 import { useAppStore } from '@/store/modules/app'
7 import { DescriptionsSchema } from '@/types/descriptions' 7 import { DescriptionsSchema } from '@/types/descriptions'
8 8
@@ -12,6 +12,8 @@ const mobile = computed(() => appStore.getMobile) @@ -12,6 +12,8 @@ const mobile = computed(() => appStore.getMobile)
12 12
13 const attrs = useAttrs() 13 const attrs = useAttrs()
14 14
  15 +const slots = useSlots()
  16 +
15 const props = defineProps({ 17 const props = defineProps({
16 title: propTypes.string.def(''), 18 title: propTypes.string.def(''),
17 message: propTypes.string.def(''), 19 message: propTypes.string.def(''),
@@ -96,6 +98,9 @@ const toggleClick = () => { @@ -96,6 +98,9 @@ const toggleClick = () => {
96 :direction="mobile ? 'vertical' : 'horizontal'" 98 :direction="mobile ? 'vertical' : 'horizontal'"
97 v-bind="getBindValue" 99 v-bind="getBindValue"
98 > 100 >
  101 + <template v-if="slots['extra']" #extra>
  102 + <slot name="extra"></slot>
  103 + </template>
99 <ElDescriptionsItem 104 <ElDescriptionsItem
100 v-for="item in schema" 105 v-for="item in schema"
101 :key="item.field" 106 :key="item.field"