Browse Source

更新组件

lex-xin 3 years ago
parent
commit
0b25b53b7e

+ 15 - 5
src/components/col-field/index.module.less

@@ -1,11 +1,21 @@
 .formTitle {
   font-size: 17px;
   color: #000;
-  line-height: 24px;
-  &::before {
-    content: '*';
-    color: #FF4E19;
-    font-size: 17px;
+  // line-height: 24px;
+  // &::before {
+  //   content: '*';
+  //   color: #FF4E19;
+  //   font-size: 17px;
+  // }
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  .col-left {
+    i {
+      font-style: normal;
+      color: #FF4E19;
+      font-size: 17px;
+    }
   }
 }
 

+ 9 - 2
src/components/col-field/index.tsx

@@ -1,10 +1,14 @@
-import { Col, Field, Row } from "vant";
+import { Button, Col, Row } from "vant";
 import { defineComponent } from "vue";
 import styles from './index.module.less';
 
 export default defineComponent({
   name: 'input',
   props: {
+    required: {
+      type: Boolean,
+      default: false
+    },
     title: {
       type: String,
       required: true
@@ -18,7 +22,10 @@ export default defineComponent({
     return (
       <Row class={styles['col-field']}>
         <Col span={24} class={styles.formTitle}>
-          {this.title}
+          <div class={styles['col-left']}>{this.required ? <i>*</i> : null}{this.title}</div>
+          <div class={styles['col-right']}>
+            {this.$slots.titleRight && this.$slots.titleRight()}
+          </div>
         </Col>
         <Col span={24} class={this.border ? 'van-hairline--bottom' : null}>
           {this.$slots.default && this.$slots.default()}

+ 1 - 1
src/teacher/teacher-cert/cert-one.tsx

@@ -36,7 +36,7 @@ export default defineComponent({
     return (
       <div class={styles.certOne}>
         <CellGroup border={false}>
-          <ColField title="真实姓名">
+          <ColField title="真实姓名" required>
             <Field
               v-model={teacherState.teacherCert.username}
               name="真实姓名"