ソースを参照

所有form相关组件增加默认清空功能

tongshangming 2 年 前
コミット
4ed290cc23
2 ファイル変更14 行追加10 行削除
  1. 10 10
      src/components/core/ProTable.vue
  2. 4 0
      src/components/core/form/FormComp.vue

+ 10 - 10
src/components/core/ProTable.vue

@@ -265,6 +265,7 @@ const formSlots = ref<FormSlot[]>([])
 buildFormSlots(props.formConfig.formItems, formSlots.value)
 // ============== 表单部分结束 ===============
 
+// 动态计算table高度
 const toolbarRef = ref<any>(null)
 const paginationRef = ref<any>(null)
 const tableHeight = computed(() => {
@@ -362,16 +363,15 @@ defineExpose({
             </vxe-column>
           </vxe-table>
         </div>
-        <div ref="paginationRef" class="flex justify-end shrink-0">
-          <el-pagination
-            background
-            layout="prev, pager, next, jumper, total"
-            v-model:current-page="curPage"
-            :page-size="pageSize"
-            :total="total"
-            class="mt-16px"
-          />
-        </div>
+        <el-pagination
+          ref="paginationRef"
+          background
+          layout="->, prev, pager, next, jumper, total"
+          v-model:current-page="curPage"
+          :page-size="pageSize"
+          :total="total"
+          class="mt-16px"
+        />
       </div>
     </el-card>
   </div>

+ 4 - 0
src/components/core/form/FormComp.vue

@@ -92,6 +92,7 @@ if (props.item.type === 'upload') {
     v-if="item.type === 'cascader'"
     style="width: 100%"
     v-model="modelValue"
+    clearable
     v-bind="item.props"
     v-on="item.events || {}"
     :placeholder="item.placeholder || placeholder(item)"
@@ -104,6 +105,7 @@ if (props.item.type === 'upload') {
     v-else-if="item.type === 'date-picker'"
     style="width: 100%"
     v-model="modelValue"
+    clearable
     v-bind="item.props"
     v-on="item.events || {}"
     :placeholder="item.placeholder || placeholder(item)"
@@ -130,6 +132,7 @@ if (props.item.type === 'upload') {
     :is="'el-' + item.type"
     :item="item"
     v-model="modelValue"
+    clearable
     v-bind="item.props"
     :placeholder="item.placeholder || placeholder(item)"
     v-on="item.events || {}"
@@ -192,6 +195,7 @@ if (props.item.type === 'upload') {
         :label="option.label"
         :value="option.value"
         :key="index"
+        clearable
         v-bind="option.props"
       >
       </el-option>