lucky 3 місяців тому
батько
коміт
dd903ce14b

+ 14 - 0
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -761,6 +761,15 @@ export default {
       this.printHandler();
     }
 
+    // 使用 $refs 获取组件实例
+    const inputNumberComponent = this.$refs.inputNumber;
+    if (inputNumberComponent) {
+      // 访问内部的输入框元素并调用 focus 方法
+      const inputElement = inputNumberComponent.$el.querySelector('input');
+      if (inputElement) {
+        inputElement.focus();
+      }
+    }
   },
   beforeDestroy() {
     this.closeWebSocket();
@@ -775,10 +784,15 @@ export default {
     handleInput(value) {
       console.log("触发了")
       const currentTime = Date.now(); // 当前时间戳
+      if(this.lastInputTime==null || this.lastInputTime==""||this.lastInputTime==undefined){
+        this.form.canisterNum = null; // 清空输入框
+        this.form.canisterNum = value.data; // 清空输入框
+      }
       // 如果 lastInputTime 存在,并且时间差超过 3 秒,则清空输入框
       if (this.lastInputTime && currentTime - this.lastInputTime > 3000) {
         console.log("三秒之后触发了")
         this.form.canisterNum = null; // 清空输入框
+        this.form.canisterNum = value.data; // 清空输入框
       }
 
       // 更新 lastInputTime 为当前时间