Browse Source

修复移动端不弹输入法的问题

黄梓星 1 year ago
parent
commit
ae266d6005
1 changed files with 15 additions and 3 deletions
  1. 15 3
      src/views/spdAddQuestion/add.vue

+ 15 - 3
src/views/spdAddQuestion/add.vue

@@ -6,7 +6,10 @@
         <el-row :gutter="10">
           <el-col :span="23">
             <el-form-item label="所属医院:" prop="hospital">
-              <el-select size="mini" clearable filterable remote v-model="basicForm.hospital" :remote-method="remoteMethod" placeholder="请选择">
+              <el-select ref="select" size="mini" clearable filterable remote v-model="basicForm.hospital" :remote-method="remoteMethod"
+               @hook:mounted="cancalReadOnly"
+              @visible-change="cancalReadOnly" 
+              placeholder="请输入关键词">
                 <el-option
                   v-for="item in yyoptions"
                   :key="item.code"
@@ -40,7 +43,7 @@
 
           <el-col :span="23">
             <el-form-item label="问题分类:" prop="problemClassification">
-              <el-select size="mini" v-model="basicForm.problemClassification" placeholder="请输入关键词">
+              <el-select size="mini" v-model="basicForm.problemClassification" placeholder="请选择">
                 <el-option
                   v-for="item in options"
                   :key="item.value"
@@ -189,7 +192,16 @@ export default {
     },
     updateData(val) {
       this.control = val
-    }
+    },
+    cancalReadOnly(onOff) {
+      this.$nextTick(() => {
+        if (!onOff) {
+          const { select } = this.$refs;
+          const input = select.$el.querySelector('.el-input__inner');
+          input.removeAttribute('readonly');
+        }
+      });
+    },
   }
 }
 </script>