Эх сурвалжийг харах

Fix: el-select ios 不能输入的问题

chris 3 жил өмнө
parent
commit
dc700bf857

+ 15 - 1
src/views/modules/common/convert-component.vue

@@ -8,7 +8,10 @@
         filterable
         remote
         :remote-method="remoteMethod"
-        @change = "onChange">
+        @change = "onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -94,6 +97,17 @@
           this.value = null
         }
         this.$emit('convertSelected', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/cus-component.vue

@@ -8,7 +8,10 @@
         filterable
         remote
         :remote-method="remoteMethod"
-        @change = "onChange">
+        @change = "onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -94,6 +97,17 @@
           this.value = null
         }
         this.$emit('cusSelected', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/draw-components.vue

@@ -10,7 +10,10 @@
         multiple
         :disabled="disabled"
         :remote-method="remoteMethod"
-        @change="onChange">
+        @change="onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -99,6 +102,17 @@
       },
       onChange (item) {
         this.$emit('change', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 14 - 0
src/views/modules/common/material-component.vue

@@ -8,6 +8,9 @@
     remote
     :remote-method="remoteMethod"
     @change = "onChange"
+    @focus="cancelReadOnly"
+    @hook:mounted="cancelReadOnly"
+    @visible-change="cancelReadOnly"
     style="width: 200px">
     <el-option
       v-for="item in options"
@@ -102,6 +105,17 @@
           this.value = null
         }
         this.$emit('materialSelected', this.options.find(item1 => item1.value === item))
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/material-type-component.vue

@@ -8,7 +8,10 @@
         filterable
         remote
         :remote-method="remoteMethod"
-        @change = "onChange">
+        @change = "onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -94,6 +97,17 @@
           this.value = null
         }
         this.$emit('typeSelected', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/template-out-component.vue

@@ -8,7 +8,10 @@
         filterable
         remote
         :remote-method="remoteMethod"
-        @change = "onChange">
+        @change = "onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -94,6 +97,17 @@
           this.value = null
         }
         this.$emit('templateSelected', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/user-component-all.vue

@@ -9,7 +9,10 @@
         remote
         :disabled="disabled"
         :remote-method="remoteMethod"
-        @change="onChange">
+        @change="onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -108,6 +111,17 @@
             this.$emit('change', val)
           }
         })
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/user-component.vue

@@ -8,7 +8,10 @@
         filterable
         remote
         :remote-method="remoteMethod"
-        @change = "onChange">
+        @change = "onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -94,6 +97,17 @@
           this.value = null
         }
         this.$emit('userSelected', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }

+ 15 - 1
src/views/modules/common/user-components.vue

@@ -10,7 +10,10 @@
         multiple
         :disabled="disabled"
         :remote-method="remoteMethod"
-        @change="onChange">
+        @change="onChange"
+        @focus="cancelReadOnly"
+        @hook:mounted="cancelReadOnly"
+        @visible-change="cancelReadOnly">
         <el-option
           v-for="item in options"
           :key="item.value"
@@ -103,6 +106,17 @@
       },
       onChange (item) {
         this.$emit('change', item)
+      },
+      cancelReadOnly (onOff) {
+        this.$nextTick(() => {
+          if (!onOff) {
+            const input = this.$refs.select.$el.querySelector('.el-input__inner')
+            const timer = setTimeout(() => {
+              input.removeAttribute('readonly')
+              clearTimeout(timer)
+            }, 200)
+          }
+        })
       }
     }
   }