Browse Source

文本域必填

zhouna 5 years ago
parent
commit
154d8aed7e
3 changed files with 14 additions and 35 deletions
  1. 13 33
      src/common/ComTextArea.vue
  2. 0 1
      src/components/Department.vue
  3. 1 1
      src/components/MainPage.vue

+ 13 - 33
src/common/ComTextArea.vue

@@ -1,12 +1,11 @@
 <template>
-  <div class="comArea" :style="getStyle(detail,slide)" @touchmove.prevent>
+  <div class="comArea" @touchmove.prevent>
     <textarea
             :style="{width:width,height:height}"
             v-model="txt"
             placeholder="请输入"
-            @focus="focus"
-            @blur="blur"></textarea>
-    <div class="realSure sure" @click="makeSuer">
+            @input="changeVal"></textarea>
+    <div :class="sure?'realSure sure':'sure'" @click="makeSuer">
       确定
     </div>
   </div>
@@ -29,48 +28,29 @@ export default {
       default: '2rem',
       type: String
     },
-    slide:{
-      default:false,
-      type:Boolean
-    },
-    detail:{
-      default:2,
-      type:Number||String
+    item:{
+      default:{}
     }
   },
   data() {
     return {
-      txt: '', //回读用
+      txt: this.item.value||'', //回读用
       sure:false,
       // txt:''
     }
   },
   methods:{
-    getStyle(detail,slide){
-      if(detail == 1){
-        if(slide){
-          return {'display':'block','background-color': '#F9F9F9'}
-        }else{
-          return {'display':'none'}
-        }
+    changeVal(e){
+      this.txt = e.target.value;
+      const notNull=this.txt.match(/\S/g);
+      if(notNull){
+        this.sure=true;
       }else{
-        return {'display':'block'}
-      }
-    },
-    blur(){
-      setTimeout(()=>{
-        $(".foot").css({'display':'block'})
-      },150)
-    },
-    focus(){
-      if(isIos()){
-        setTimeout(() => {
-          $(".foot").css({'display':'none'})
-        }, 150);
+        this.sure=false;
       }
     },
     makeSuer(){
-      //if(!this.sure){return}
+      if(!this.sure){return}
       let n = this.num;
       this.$emit("updata",'',{val:this.txt||'无',valp:this.txt||'无'},++n);
     }

+ 0 - 1
src/components/Department.vue

@@ -75,7 +75,6 @@
             }
         },
         mounted(){
-            document.title = '挂号信息';console.log(11)
             this.$nextTick(()=>{
                 let scroll = setScroll(BScroll,true,'.departmentView')
                 this.scroll = scroll

+ 1 - 1
src/components/MainPage.vue

@@ -73,7 +73,7 @@
            :key="symptomResult.id"
            @updata="updataResultSingle"/>-->
     <!-- 文本域 -->
-    <ComTextArea v-if="type==6 || type == 5"
+    <ComTextArea v-if="type == 5"
                  :num="num"
                  :item="symptomResult"
                  width="92%"