Commit 6a542b61047ec3a26211751bf776314d244d87af
1 parent
983a6369
perf: 优化描述组件
Showing
1 changed file
with
6 additions
and
1 deletions
yudao-ui-admin-vue3/src/components/Descriptions/src/Descriptions.vue
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | import { ElCollapseTransition, ElDescriptions, ElDescriptionsItem, ElTooltip } from 'element-plus' |
| 3 | 3 | import { useDesign } from '@/hooks/web/useDesign' |
| 4 | 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 | 6 | import { useAppStore } from '@/store/modules/app' |
| 7 | 7 | import { DescriptionsSchema } from '@/types/descriptions' |
| 8 | 8 | |
| ... | ... | @@ -12,6 +12,8 @@ const mobile = computed(() => appStore.getMobile) |
| 12 | 12 | |
| 13 | 13 | const attrs = useAttrs() |
| 14 | 14 | |
| 15 | +const slots = useSlots() | |
| 16 | + | |
| 15 | 17 | const props = defineProps({ |
| 16 | 18 | title: propTypes.string.def(''), |
| 17 | 19 | message: propTypes.string.def(''), |
| ... | ... | @@ -96,6 +98,9 @@ const toggleClick = () => { |
| 96 | 98 | :direction="mobile ? 'vertical' : 'horizontal'" |
| 97 | 99 | v-bind="getBindValue" |
| 98 | 100 | > |
| 101 | + <template v-if="slots['extra']" #extra> | |
| 102 | + <slot name="extra"></slot> | |
| 103 | + </template> | |
| 99 | 104 | <ElDescriptionsItem |
| 100 | 105 | v-for="item in schema" |
| 101 | 106 | :key="item.field" | ... | ... |