Forráskód Böngészése

供应商关联产品设置成本价,默认首项获取焦点回车提交数据

chenrui 3 éve
szülő
commit
2dd88ffaa4

+ 11 - 0
src/views/supplierManagement/associatedProduct/settingCost.vue

@@ -31,6 +31,8 @@
               :min="0"
               :max="999999"
               placeholder="请输入"
+              ref="cost"
+              @keyup.enter.native="onSubmit"
               style="width: 100%;" />
           </a-form-model-item>
           <div style="display: flex;justify-content: center;padding: 30px 0;">
@@ -120,6 +122,15 @@ export default {
     //  父页面传过来的弹框状态
     openModal (newValue, oldValue) {
       this.isShow = newValue
+      if (newValue) {
+        // 默认首项获取焦点
+        const _this = this
+        setTimeout(() => {
+          if (_this.$refs['cost']) {
+            _this.$refs['cost'].focus()
+          }
+        }, 300)
+      }
     },
     //  重定义的弹框状态
     isShow (newValue, oldValue) {