From 23635a1e887584560247bb523eef8b546655e3c4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-A1SENDA\\HUzy" <472860318@qq.com> Date: Thu, 1 Jul 2021 15:30:28 +0800 Subject: [PATCH] --- --- components/city-change/index.js | 43 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/components/city-change/index.js b/components/city-change/index.js index b92c134..e38ced5 100644 --- a/components/city-change/index.js +++ b/components/city-change/index.js @@ -220,42 +220,47 @@ Component({ // } //开始触摸事件 touchStart: function (e) { - console.log('开始') - + this.data.touchEndy = e.touches[0].pageY-this.data.topHeight; }, touchMove: function (e) { this.data.touchEndy = e.touches[0].pageY-this.data.topHeight; var lindex = parseInt(this.data.touchEndy / this.data.rightheight * 26);//根据前面分析获取手指触摸位置在letters中的index值 var value = this.data.letter[lindex]; - console.log(value) - this.setData({ - cityListId: value - }); + if(value){ + this.setData({ + cityListId: value + }); + } this.titleDialog(value) }, touchEnd: function (e) { - console.log('结束') var lindex = parseInt(this.data.touchEndy / this.data.rightheight * 26);//根据前面分析获取手指触摸位置在letters中的index值 var value = this.data.letter[lindex]; - this.setData({ - cityListId: value - }); - console.log(value) + if(value){ + this.setData({ + cityListId: value + }); + } + this.titleDialog(value) }, titleDialog: function (value) { - this.setData({ - dialongValue:value, - dialogIsShow:true - }) - setTimeout(() => { + if(value){ this.setData({ - dialongValue:null, - dialogIsShow:false + dialongValue:value, + dialogIsShow:true }) - }, 1500); + setTimeout(() => { + this.setData({ + dialongValue:null, + dialogIsShow:false + }) + }, 1500); + } + + }, }, ready() {