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() {