File tree 1 file changed +7
-4
lines changed
components/uni-indexed-list 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 49
49
50
50
function touchMove (e ) {
51
51
let pageY = e .touches [0 ].pageY
52
- let index = Math .floor (pageY / this .itemHeight )
52
+ let index = Math .floor (( pageY - this . winOffsetY ) / this .itemHeight )
53
53
if (this .touchmoveIndex === index) {
54
54
return false
55
55
}
71
71
// #endif
72
72
73
73
/**
74
- * IndexedList 索引列表
74
+ * IndexedList 索引列表
75
75
* @description 用于展示索引列表
76
76
* @tutorial https://ext.dcloud.net.cn/plugin?id=375
77
77
* @property {Boolean} showSelect = [true|false] 展示模式
104
104
lists: [],
105
105
winHeight: 0 ,
106
106
itemHeight: 0 ,
107
+ winOffsetY: 0 ,
107
108
touchmove: false ,
108
109
touchmoveIndex: - 1 ,
109
110
scrollViewId: ' ' ,
158
159
.select (' #list' )
159
160
.boundingClientRect ()
160
161
.exec (ret => {
162
+ this .winOffsetY = ret[0 ].top
161
163
this .winHeight = ret[0 ].height
162
164
this .itemHeight = this .winHeight / this .lists .length
163
165
})
164
166
// #endif
165
167
// #ifdef APP-NVUE
166
168
dom .getComponentRect (this .$refs [' list' ], (res ) => {
169
+ this .winOffsetY = res .size .top
167
170
this .winHeight = res .size .height
168
171
this .itemHeight = this .winHeight / this .lists .length
169
172
})
172
175
touchStart (e ) {
173
176
this .touchmove = true
174
177
let pageY = e .touches [0 ].pageY
175
- let index = Math .floor (pageY / this .itemHeight )
178
+ let index = Math .floor (( pageY - this . winOffsetY ) / this .itemHeight )
176
179
let item = this .lists [index]
177
180
if (item) {
178
181
this .scrollViewId = ' uni-indexed-list-' + index
187
190
touchMove (e ) {
188
191
// #ifndef APP-PLUS
189
192
let pageY = e .touches [0 ].pageY
190
- let index = Math .floor (pageY / this .itemHeight )
193
+ let index = Math .floor (( pageY - this . winOffsetY ) / this .itemHeight )
191
194
if (this .touchmoveIndex === index) {
192
195
return false
193
196
}
You can’t perform that action at this time.
0 commit comments