Browse Source

fix: 绑定托盘批次 提交请求后自动聚焦运单号输入框,可连续枪扫

Hello小健 3 months ago
parent
commit
6b30426d68
1 changed files with 13 additions and 3 deletions
  1. 13 3
      pages/scanLotno/index.vue

+ 13 - 3
pages/scanLotno/index.vue

@@ -67,7 +67,7 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue';
+import { reactive, ref, nextTick } from 'vue';
 import permision from '@/common/permission.js';
 import { onShow, onLoad, onUnload, onHide, onBackPress, onNavigationBarButtonTap } from '@dcloudio/uni-app';
 import { getBindParamsURL, bindShippingURL, getWaybillsURL } from '@/utils/api.js';
@@ -254,6 +254,7 @@ const onsubmit = () => {
 				getHistory();
 			}
 			st = setTimeout(() => {
+				setFocus();
 				reset();
 				st && clearTimeout(st);
 			}, 1000);
@@ -311,11 +312,20 @@ onBackPress(() => {
 	// #endif
 });
 onShow(() => {
+	hidePage.value = false;
 	token.value = uni.getStorageSync('token');
 	getBindParams();
 	getHistory();
 });
-
+const setFocus = () => {
+	if (hidePage.value) {
+		return;
+	}
+	focusType.value = false;
+	nextTick(() => {
+		focusType.value = true;
+	});
+};
 const getBindParams = () => {
 	uni.request({
 		url: getBindParamsURL,
@@ -439,4 +449,4 @@ onNavigationBarButtonTap((event) => {
 		color: #999;
 	}
 }
-</style>
+</style>