fan 2 лет назад
Родитель
Сommit
89d9ffc817

+ 12 - 1
src/components/Form/src/BasicForm.vue

@@ -14,7 +14,16 @@
           :class="['form-plainTit ant-col', 'ant-col-' + (schema.colProps?.span || '24')]"
           style="padding-left: 8px; padding-right: 8px"
         >
-          {{ schema.defaultValue }}
+          <div>
+            {{ schema.defaultValue }}
+          </div>
+          <div
+            :style="{ color: schema.subLabelColor }"
+            @click="() => setFormModel(schema.field, '')"
+            class="cursor-pointer"
+          >
+            {{ schema.subLabel }}
+          </div>
         </div>
         <FormItem
           v-else
@@ -361,6 +370,8 @@
       margin-top: 10px;
       margin-bottom: 10px;
       padding-left: 16px !important;
+      display: flex;
+      justify-content: space-between;
       // margin-left: 30px;
       &::after {
         position: absolute;

+ 4 - 1
src/components/Form/src/components/FormItem.vue

@@ -301,6 +301,7 @@
           subLabel,
           subLabelColor,
           labelColor,
+          labelClass,
           field,
         } = props.schema;
         const renderLabel = subLabel ? (
@@ -318,7 +319,9 @@
             </div>
           </div>
         ) : (
-          <span style={{ color: labelColor }}>{label}</span>
+          <span class={labelClass} style={{ color: labelColor }}>
+            {label}
+          </span>
         );
         const getHelpMessage = isFunction(helpMessage)
           ? helpMessage(unref(getValues))

+ 2 - 0
src/components/Form/src/types/form.ts

@@ -135,6 +135,8 @@ export interface FormSchema {
   label?: string | VNode;
   // Auxiliary text color
   labelColor?: string;
+  // 额外的label 样式
+  labelClass?: string;
   // Tip 提示
   tip?: string;
   // Auxiliary text