Просмотр исходного кода

回车键快捷定位表单下一项

chenrui 3 лет назад
Родитель
Сommit
84020b1051
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      src/views/productManagement/productInfo/edit.vue

+ 10 - 4
src/views/productManagement/productInfo/edit.vue

@@ -57,13 +57,15 @@
                 id="productInfoEdit-unit-input"
                 placeholder="请输入基本单位"
                 ref="unit"
-                @keydown.enter.native="nextFocus('unit', 'productBrandSn', $event)"
+                @keydown.enter.native="nextFocus('unit', 'UNIT', $event, 'vSelect')"
                 allowClear/>
               <v-select
                 style="width: 20%"
                 code="UNIT"
                 @change="unitChange"
                 id="productInfoEdit-unit"
+                ref="UNIT"
+                @keydown.enter.native="nextFocus('UNIT', 'productBrandSn', $event)"
                 placeholder="快速选择单位"></v-select>
             </a-input-group>
           </a-form-model-item>
@@ -280,13 +282,17 @@ export default {
       })
     },
     // 回车键快捷定位表单下一项
-    nextFocus (nowRef, nextRef, event) {
+    nextFocus (nowRef, nextRef, event, isComponent) {
       const _this = this
       if (_this.$refs[nowRef]) {
         _this.$nextTick(() => {
-          event.target.blur()
           if (_this.$refs[nextRef]) {
-            _this.$refs[nextRef].focus()
+            event.target.blur()
+            if (isComponent == 'vSelect') {
+              _this.$refs[nextRef].$children[0].focus()
+            } else {
+              _this.$refs[nextRef].focus()
+            }
           }
         })
       }