From d370e786bc369c3b161b20a4027ef989fa133208 Mon Sep 17 00:00:00 2001 From: cyy <cuiqian2004@163.com> Date: 星期一, 17 六月 2024 22:11:36 +0800 Subject: [PATCH] 多次设置焦点问题 --- pages/modal/5602.vue | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pages/modal/5602.vue b/pages/modal/5602.vue index c39c947..bee0d0a 100644 --- a/pages/modal/5602.vue +++ b/pages/modal/5602.vue @@ -410,6 +410,7 @@ ClsID2: "Sorting_Result", param: {}, focusFieldId:"", + focusOldFieldId:"", head_styledef:{ form:{ items:[] @@ -642,6 +643,7 @@ ontap(index,item){ //鎵爜鍔熻兘 // var $ele = e; + this.focusOldFieldId = item.fieldId getApp().onScan((result)=>{ console.log(result.decodedata); item.value = result.decodedata; @@ -829,7 +831,7 @@ else if(item.action_type == "set_subtable_page_content"){ //宸插垎鎷� $this.$data.param.Show_Welcom_Page=false; var value = item.value; - if(value.clear == true && $this.$data.detail1StyleDefList.length>0 && value.page_name == $this.$data.param.Sub_Page[0].Name){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鍒嗘嫞鏄惁鏈夋暟鎹�+ if( value.clear_confirm != false && value.clear == true && $this.$data.detail1StyleDefList.length>0 && value.page_name == $this.$data.param.Sub_Page[0].Name){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,姝e湪鍒嗘嫞鏄惁鏈夋暟鎹� uni.showModal({ title: '鎻愮ず', content: '绯荤粺妫�祴鍒版湁寰呭垎鎷d腑鐨勬暟鎹紝缁х画鎿嶄綔浼氭竻绌猴紝鏄惁缁х画锛�, @@ -910,9 +912,14 @@ } } else if (item.action_type == "set_dlg_current_edit_attr") { - if($this.focusFieldId == item.value) + if($this.focusOldFieldId == item.value) $this.setData({focusFieldId: ""}) - $this.setData({focusFieldId:item.value}) + else{ + $this.setData({focusFieldId:$this.focusOldFieldId}) + } + $this.$nextTick(()=> { + $this.setData({focusFieldId:item.value}) + }); } else if(item.action_type == "set_dlg_attr"){ // value = {"attr":"xxx", "value":"xxx"} @@ -1623,7 +1630,7 @@ } else if(item.action_type == "set_subtable_page_content"){ //鍔犺浇澶氭潯鏁版嵁 $this.param.Show_Welcom_Page=false; var value = item.value; - if(value.clear == true && $this.detail1StyleDefList.length>0){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,寰呭垎鎷f槸鍚︽湁鏁版嵁 + if(value.clear_confirm != false && value.clear == true && $this.detail1StyleDefList.length>0){ //鍒ゆ柇鏄惁娓呯┖椤电鍐呭,寰呭垎鎷f槸鍚︽湁鏁版嵁 uni.showModal({ title: '鎻愮ず', content: '绯荤粺妫�祴鍒版湁寰呭垎鎷d腑鐨勬暟鎹紝缁х画鎿嶄綔浼氭竻绌猴紝鏄惁缁х画锛�, @@ -1672,9 +1679,14 @@ } } else if (item.action_type == "set_dlg_current_edit_attr") { - if($this.focusFieldId == item.value) + if($this.focusOldFieldId == item.value) $this.setData({focusFieldId: ""}) - $this.setData({focusFieldId:item.value}) + else{ + $this.setData({focusFieldId:$this.focusOldFieldId}) + } + $this.$nextTick(()=> { + $this.setData({focusFieldId:item.value}) + }); } else if(item.action_type == "refresh"){ //鍒锋柊 var value = item.value; -- Gitblit v1.9.1