Explorar el Código

change procardlist span

tongshangming hace 3 años
padre
commit
6b4ef80291
Se han modificado 2 ficheros con 9 adiciones y 6 borrados
  1. 8 5
      src/components/ProCardList.vue
  2. 1 1
      src/views/list/CardList.vue

+ 8 - 5
src/components/ProCardList.vue

@@ -17,12 +17,14 @@ interface Props {
   height?: string
   cardHeight?: string
   showAdd?: boolean
+  span?: number
 }
 
 const props = withDefaults(defineProps<Props>(), {
   pageSize: 12,
   showAdd: true,
-  cardHeight: '246px'
+  cardHeight: '226px',
+  span: 4
 })
 
 const emits = defineEmits(['click-create', 'click-edit'])
@@ -171,15 +173,16 @@ defineExpose({
 
         <div class="h-full flex-grow">
           <el-row :gutter="10">
-            <el-col :span="6" v-if="showAdd" class="mb-10">
+            <el-col :span="span" v-bind="$attrs" v-if="showAdd" class="mb-10">
               <div
-                class="flex items-center justify-center border border-dashed w-full h-full card-list-item"
+                class="flex items-center justify-center border border-dashed w-full h-full card-list-item cursor-pointer"
                 :style="{ height: cardHeight }"
+                @click="handleCreate"
               >
-                <el-button link icon="plus" @click="handleCreate">新增</el-button>
+                <el-button link icon="plus">新增</el-button>
               </div>
             </el-col>
-            <el-col :span="6" v-for="(item, index) in tableData" :key="item.id" class="mb-10">
+            <el-col :span="span" v-bind="$attrs" v-for="(item, index) in tableData" :key="item.id" class="mb-10">
               <el-card :body-style="{ padding: '0px' }" shadow="hover">
                 <slot :item="item" :index="index"></slot>
               </el-card>

+ 1 - 1
src/views/list/CardList.vue

@@ -77,7 +77,7 @@ const handleDelete = (item: any) => {
 <template>
   <pro-card-list :crud="CRUD" :formConfig="formConfig" ref="cardList">
     <template #default="{ item }">
-      <img :src="item.image" class="block w-full h-200px" />
+      <img :src="item.image" class="block w-full h-180px" />
       <el-row class="text-center p-10px card-operate">
         <el-col :span="12">
           <el-button link icon="edit" @click="handleEdit(item)">编辑</el-button>