Browse Source

fix: BsUi-基础描述增加插槽

hanxiaohui 7 months ago
parent
commit
a7632cc146
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/components/BsUi/Descriptions/index.vue

+ 5 - 2
src/components/BsUi/Descriptions/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="description">
     <div class="d-title">{{ title }}</div>
-    <a-descriptions :bordered="false">
+    <slot></slot>
+    <a-descriptions v-if="!isEmpty(items)" :bordered="false">
       <a-descriptions-item v-for="(item, index) in items" :key="index" v-bind="item.extraProps">
         <template #label>
           <slot v-if="item.labelSlot" :name="item.labelSlot"></slot>
@@ -19,13 +20,15 @@
   </div>
 </template>
 <script setup>
+  import { isEmpty } from 'lodash';
+
   const props = defineProps({
     title: {
       required: true,
       default: '',
     },
     items: {
-      required: true,
+      required: false,
       default: [],
     },
   });