File tree 3 files changed +19
-5
lines changed
3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 5
5
node_modules /
6
6
npm-debug.log
7
7
yarn-error.log
8
- yarn.lock
8
+ yarn.lock
9
+ stats.json
Original file line number Diff line number Diff line change 33
33
<div class =" wd-scroller-no-infinite-loading-text" >{{noDataText}}</div >
34
34
</div >
35
35
</template >
36
- <template v-else >
36
+ <template v-else-if = " showLoadingState " >
37
37
<div class =" wd-scroller-infinite-load-tip-wrap" v-show =" infiniteLoadingState !== 1" >
38
38
<div class =" wd-scroller-bottom-text" >{{loadText}}</div >
39
39
</div >
@@ -95,6 +95,7 @@ export default {
95
95
noRefresh: false ,
96
96
noRefreshStyle: false ,
97
97
noLoad: false ,
98
+ showLoadingState: true ,
98
99
$scrollTarget: null ,
99
100
$slotWrapper: null ,
100
101
render: null ,
@@ -322,6 +323,18 @@ export default {
322
323
},
323
324
finishInfiniteLoading () {
324
325
this .infiniteLoadingState = 0
326
+ /**
327
+ * 如果未拉来数据,或者新 DOM 高度过低,调整 scroll 位置避免露出底部提示文字
328
+ */
329
+ let transformY = - (translateUtils .getElementTranslate (this .$refs .content ).top )
330
+ let contentHeight = this .$refs .slotWrapper .getBoundingClientRect ().height
331
+ if (this .containerHeight + transformY > contentHeight) {
332
+ this .showLoadingState = false
333
+ this .scroller .scrollTo (0 , contentHeight - this .containerHeight , true )
334
+ setTimeout (() => {
335
+ this .showLoadingState = true
336
+ }, this .animationDuration )
337
+ }
325
338
},
326
339
noMoreRefresh () {
327
340
this .noRefresh = true
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ let getTranslate = function(element) {
39
39
}
40
40
41
41
let transform = element . style [ transformProperty ]
42
- let matches = / t r a n s l a t e \( \s * ( - ? \d + ( \. ? \d + ? ) ? ) p x , \s * ( - ? \d + ( \. \d + ) ? ) p x \) \s * t r a n s l a t e Z \( 0 p x \) / g . exec ( transform )
43
- if ( matches ) {
42
+ let matches = transform . match ( / t r a n s l a t e 3 d \( \s * ( - ? \d + \. ? \d * ) p x , \s * ( - ? \d + \. ? \d * ) p x , . * \) / )
43
+ if ( matches ) {
44
44
result . left = + matches [ 1 ]
45
- result . top = + matches [ 3 ]
45
+ result . top = + matches [ 2 ]
46
46
}
47
47
48
48
return result
You can’t perform that action at this time.
0 commit comments