这个问题2020年还是存在
scroll-view 快速多次改变scroll-into-view属性值出问题scroll-view 快速多次改变scroll-into-view属性值后,滑动到的位置就不准确了 [图片] [代码]<[代码][代码]scroll-view[代码] [代码]class[代码][代码]=[代码][代码]"content"[代码] [代码]scroll-into-view[代码][代码]=[代码][代码]"{{toView}}"[代码] [代码]scroll-y[代码][代码]=[代码][代码]"true"[代码] [代码]scroll-with-animation[代码][代码]=[代码][代码]"true"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]wx:for[代码][代码]=[代码][代码]"{{act_addList}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"address_top"[代码] [代码]id[代码][代码]=[代码][代码]"{{ 'inToView'+item.id}}"[代码][代码]>{{item.region}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]wx:for[代码][代码]=[代码][代码]"{{item.city}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"address_bottom"[代码][代码]>{{item.name}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码]</[代码][代码]scroll-view[代码][代码]>[代码] [代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"orientation_region"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"orientation"[代码][代码]>自动定位</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]block[代码] [代码]wx:for[代码][代码]=[代码][代码]"{{orientationList}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"orientation_city"[代码] [代码]bindtap[代码][代码]=[代码][代码]"scrollToViewFn"[代码] [代码]data-id[代码][代码]=[代码][代码]"{{item.id}}"[代码][代码]>{{item.region}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]block[代码][代码]>[代码][代码]</[代码][代码]view[代码][代码]>[代码][代码]page{ [代码][代码]height[代码][代码]: [代码][代码]100%[代码][代码];} [代码][代码].content{[代码][代码]padding-bottom[代码][代码]: [代码][代码]20[代码][代码]rpx; box-sizing: border-box; [代码][代码]height[代码][代码]: [代码][代码]100%[代码][代码];} [代码][代码].location{[代码][代码]width[代码][代码]: [代码][代码]100%[代码][代码];} [代码][代码].location_top{[代码][代码]height[代码][代码]: [代码][代码]76[代码][代码]rpx;[代码][代码]line-height[代码][代码]: [代码][代码]76[代码][代码]rpx; [代码][代码]background[代码][代码]: [代码][代码]#f4f4f4[代码][代码];[代码][代码]color[代码][代码]: [代码][代码]#606660[代码][代码];[代码][代码]font-size[代码][代码]: [代码][代码]28[代码][代码]rpx;[代码][代码]padding[代码][代码]: [代码][代码]0[代码] [代码]20[代码][代码]rpx;} [代码][代码].location_bottom{[代码][代码]height[代码][代码]: [代码][代码]140[代码][代码]rpx;[代码][代码]line-height[代码][代码]: [代码][代码]140[代码][代码]rpx;[代码][代码]color[代码][代码]: [代码][代码]#d91f16[代码][代码];[代码][代码]font-size[代码][代码]: [代码][代码]28[代码][代码]rpx;[代码][代码]border-top[代码][代码]: [代码][代码]2[代码][代码]rpx [代码][代码]#ebebeb[代码] [代码]solid[代码][代码]; [代码][代码]border-bottom[代码][代码]: [代码][代码]2[代码][代码]rpx [代码][代码]#ebebeb[代码] [代码]solid[代码][代码];[代码][代码]padding[代码][代码]: [代码][代码]0[代码] [代码]20[代码][代码]rpx; align-items: [代码][代码]center[代码][代码];[代码][代码]display[代码][代码]: -webkit-flex;} [代码][代码].address_top{[代码][代码]height[代码][代码]: [代码][代码]76[代码][代码]rpx;[代码][代码]line-height[代码][代码]: [代码][代码]76[代码][代码]rpx; [代码][代码]background[代码][代码]: [代码][代码]#f4f4f4[代码][代码];[代码][代码]color[代码][代码]: [代码][代码]#999999[代码][代码];[代码][代码]font-size[代码][代码]: [代码][代码]28[代码][代码]rpx;[代码][代码]padding[代码][代码]: [代码][代码]0[代码] [代码]20[代码][代码]rpx;} [代码][代码].address_bottom{[代码][代码]height[代码][代码]: [代码][代码]88[代码][代码]rpx;[代码][代码]line-height[代码][代码]: [代码][代码]88[代码][代码]rpx; [代码][代码]background[代码][代码]: [代码][代码]#fff[代码][代码];[代码][代码]color[代码][代码]: [代码][代码]#000000[代码][代码];[代码][代码]font-size[代码][代码]: [代码][代码]32[代码][代码]rpx;[代码][代码]padding[代码][代码]: [代码][代码]0[代码] [代码]20[代码][代码]rpx; [代码][代码]border-bottom[代码][代码]: [代码][代码]2[代码][代码]rpx [代码][代码]#ebebeb[代码] [代码]solid[代码][代码];[代码][代码]margin-left[代码][代码]: [代码][代码]20[代码][代码]rpx;[代码][代码]margin-right[代码][代码]: [代码][代码]50[代码][代码]rpx; } [代码][代码].location_img{[代码][代码]width[代码][代码]: [代码][代码]48[代码][代码]rpx;[代码][代码]height[代码][代码]: [代码][代码]48[代码][代码]rpx;[代码][代码]position[代码][代码]: [代码][代码]absolute[代码][代码];[代码][代码]right[代码][代码]: [代码][代码]20[代码][代码]rpx;[代码][代码]top[代码][代码]: [代码][代码]125[代码][代码]rpx;} [代码][代码].add_city{[代码][代码]width[代码][代码]: [代码][代码]228[代码][代码]rpx;[代码][代码]height[代码][代码]: [代码][代码]60[代码][代码]rpx;[代码][代码]line-height[代码][代码]: [代码][代码]60[代码][代码]rpx; [代码][代码]text-align[代码][代码]: [代码][代码]center[代码][代码]; [代码][代码]border[代码][代码]: [代码][代码]2[代码][代码]rpx [代码][代码]solid[代码] [代码]#ebebeb[代码][代码]; [代码][代码]color[代码][代码]: [代码][代码]#000000[代码][代码];[代码][代码]margin-right[代码][代码]: [代码][代码]20[代码][代码]rpx; } [代码][代码].add_citying{[代码][代码]width[代码][代码]: [代码][代码]228[代码][代码]rpx;[代码][代码]height[代码][代码]: [代码][代码]60[代码][代码]rpx;[代码][代码]line-height[代码][代码]: [代码][代码]60[代码][代码]rpx; [代码][代码]text-align[代码][代码]: [代码][代码]center[代码][代码]; [代码][代码]border[代码][代码]: [代码][代码]2[代码][代码]rpx [代码][代码]solid[代码] [代码]#09bb07[代码][代码]; [代码][代码]color[代码][代码]: [代码][代码]#09bb07[代码][代码];[代码][代码]margin-right[代码][代码]: [代码][代码]20[代码][代码]rpx;} [代码][代码].orientation{[代码][代码]white-space[代码][代码]:[代码][代码]normal[代码][代码];[代码][代码]display[代码][代码]: inline-[代码][代码]block[代码][代码]; [代码][代码]width[代码][代码]: [代码][代码]55[代码][代码]rpx;[代码][代码]height[代码][代码]:[代码][代码]58[代码][代码]rpx; [代码][代码]color[代码][代码]: [代码][代码]#999[代码][代码]; [代码][代码]text-align[代码][代码]: [代码][代码]center[代码][代码];} [代码][代码].orientation_region{ [代码][代码]width[代码][代码]: [代码][代码]55[代码][代码]rpx;[代码][代码]font-size[代码][代码]: [代码][代码]20[代码][代码]rpx;[代码][代码]position[代码][代码]: [代码][代码]fixed[代码][代码];[代码][代码]top[代码][代码]: [代码][代码]220[代码][代码]rpx; [代码][代码]right[代码][代码]: [代码][代码]0[代码][代码]rpx;} [代码][代码].orientation_city{[代码][代码]height[代码][代码]: [代码][代码]50[代码][代码]rpx; [代码][代码]line-height[代码][代码]: [代码][代码]50[代码][代码]rpx;[代码][代码]color[代码][代码]: [代码][代码]#000[代码][代码];[代码][代码]text-align[代码][代码]: [代码][代码]center[代码][代码];}[代码][代码]Page({[代码] [代码] [代码][代码]/** [代码][代码] [代码][代码]* 页面的初始数据 [代码][代码] [代码][代码]*/[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]orientationList: [[代码][代码] [代码][代码]{ id: [代码][代码]"01"[代码][代码], region: [代码][代码]"东北"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"02"[代码][代码], region: [代码][代码]"华北"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"03"[代码][代码], region: [代码][代码]"华东"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"04"[代码][代码], region: [代码][代码]"华南"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"05"[代码][代码], region: [代码][代码]"华中"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"06"[代码][代码], region: [代码][代码]"西北"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"07"[代码][代码], region: [代码][代码]"西南"[代码] [代码]}[代码][代码] [代码][代码]],[代码][代码] [代码][代码]act_addList: [[代码][代码] [代码][代码]{[代码][代码] [代码][代码]id: [代码][代码]"01"[代码][代码], region: [代码][代码]"东北地区"[代码][代码],[代码][代码] [代码][代码]city: [{ id: [代码][代码]"0101"[代码][代码], name: [代码][代码]"白山江源"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0102"[代码][代码], name: [代码][代码]"白山市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0103"[代码][代码], name: [代码][代码]"宾县"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0104"[代码][代码], name: [代码][代码]"大庆"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0105"[代码][代码], name: [代码][代码]"测试1"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0106"[代码][代码], name: [代码][代码]"测试2"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0107"[代码][代码], name: [代码][代码]"测试3"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0108"[代码][代码], name: [代码][代码]"测试4"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0109"[代码][代码], name: [代码][代码]"测试5"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0110"[代码][代码], name: [代码][代码]"测试6"[代码] [代码]},[代码][代码] [代码][代码]][代码][代码] [代码][代码]},[代码][代码] [代码][代码]{[代码][代码] [代码][代码]id: [代码][代码]"02"[代码][代码], region: [代码][代码]"华北地区"[代码][代码],[代码][代码] [代码][代码]city: [{ id: [代码][代码]"0201"[代码][代码], name: [代码][代码]"包头"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0202"[代码][代码], name: [代码][代码]"保定"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0206"[代码][代码], name: [代码][代码]"测试2"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0207"[代码][代码], name: [代码][代码]"测试3"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0208"[代码][代码], name: [代码][代码]"测试4"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0209"[代码][代码], name: [代码][代码]"测试5"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0210"[代码][代码], name: [代码][代码]"测试6"[代码] [代码]},[代码] [代码] [代码][代码]][代码][代码] [代码][代码]},[代码][代码] [代码][代码]{[代码][代码] [代码][代码]id: [代码][代码]"03"[代码][代码], region: [代码][代码]"华东地区"[代码][代码],[代码][代码] [代码][代码]city: [{ id: [代码][代码]"0303"[代码][代码], name: [代码][代码]"开封市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"3104"[代码][代码], name: [代码][代码]"安阳市"[代码] [代码]},][代码][代码] [代码][代码]},[代码][代码] [代码][代码]{[代码][代码] [代码][代码]id: [代码][代码]"04"[代码][代码], region: [代码][代码]"华南地区"[代码][代码],[代码][代码] [代码][代码]city: [[代码][代码] [代码][代码]{ id: [代码][代码]"0401"[代码][代码], name: [代码][代码]"黑龙江市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0407"[代码][代码], name: [代码][代码]"测试3"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0508"[代码][代码], name: [代码][代码]"测试4"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0609"[代码][代码], name: [代码][代码]"测试5"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0710"[代码][代码], name: [代码][代码]"测试6"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0711"[代码][代码], name: [代码][代码]"测试8"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0712"[代码][代码], name: [代码][代码]"测试9"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0713"[代码][代码], name: [代码][代码]"测试10"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0714"[代码][代码], name: [代码][代码]"测试11"[代码] [代码]},[代码][代码] [代码][代码]][代码][代码] [代码][代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"05"[代码][代码], region: [代码][代码]"华中地区"[代码][代码], city: [{ id: [代码][代码]"0501"[代码][代码], name: [代码][代码]"黑龙江市"[代码] [代码]}] },[代码] [代码] [代码][代码]{[代码][代码] [代码][代码]id: [代码][代码]"06"[代码][代码], region: [代码][代码]"西北地区"[代码][代码],[代码][代码] [代码][代码]city: [{ id: [代码][代码]"0603"[代码][代码], name: [代码][代码]"开封市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0604"[代码][代码], name: [代码][代码]"安阳市"[代码] [代码]},][代码][代码] [代码][代码]},[代码][代码] [代码][代码]{[代码][代码] [代码][代码]id: [代码][代码]"07"[代码][代码], region: [代码][代码]"西南地区"[代码][代码],[代码][代码] [代码][代码]city: [{ id: [代码][代码]"0703"[代码][代码], name: [代码][代码]"开封市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0704"[代码][代码], name: [代码][代码]"安阳市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0401"[代码][代码], name: [代码][代码]"黑龙江市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0407"[代码][代码], name: [代码][代码]"测试3"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0508"[代码][代码], name: [代码][代码]"测试4"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0609"[代码][代码], name: [代码][代码]"测试5"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0710"[代码][代码], name: [代码][代码]"测试6"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0711"[代码][代码], name: [代码][代码]"测试8"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0712"[代码][代码], name: [代码][代码]"测试9"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0713"[代码][代码], name: [代码][代码]"测试10"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0714"[代码][代码], name: [代码][代码]"测试11"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0401"[代码][代码], name: [代码][代码]"黑龙江市"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0407"[代码][代码], name: [代码][代码]"测试3"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0508"[代码][代码], name: [代码][代码]"测试4"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0609"[代码][代码], name: [代码][代码]"测试5"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0710"[代码][代码], name: [代码][代码]"测试6"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0711"[代码][代码], name: [代码][代码]"测试8"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0712"[代码][代码], name: [代码][代码]"测试9"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0713"[代码][代码], name: [代码][代码]"测试10"[代码] [代码]},[代码][代码] [代码][代码]{ id: [代码][代码]"0714"[代码][代码], name: [代码][代码]"测试11"[代码] [代码]},[代码][代码] [代码][代码]][代码][代码] [代码][代码]},[代码][代码] [代码][代码]],[代码][代码] [代码][代码]toView: [代码][代码]'inToView01'[代码][代码],[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]scrollToViewFn: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]var[代码] [代码]_id = e.target.dataset.id;[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]toView: [代码][代码]'inToView'[代码] [代码]+ _id[代码][代码] [代码][代码]})[代码][代码] [代码][代码]console.log([代码][代码]this[代码][代码].data.toView)[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码] [代码] [代码][代码]}[代码][代码]})[代码]
2020-04-13