File tree Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Expand file tree Collapse file tree 3 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,8 @@ import Icon from '../icon';
2
2
import Cell from '../cell' ;
3
3
import { cellProps } from '../cell/shared' ;
4
4
import { preventDefault } from '../utils/dom/event' ;
5
- import { getRootScrollTop , setRootScrollTop } from '../utils/dom/scroll' ;
5
+ import { resetScroll } from '../utils/dom/reset- scroll' ;
6
6
import { createNamespace , isObj , isDef , addUnit } from '../utils' ;
7
- import { isIOS } from '../utils/validate/system' ;
8
7
9
8
const [ createComponent , bem ] = createNamespace ( 'field' ) ;
10
9
@@ -134,13 +133,7 @@ export default createComponent({
134
133
onBlur ( event ) {
135
134
this . focused = false ;
136
135
this . $emit ( 'blur' , event ) ;
137
-
138
- // Hack for iOS12 page scroll
139
- // https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
140
- /* istanbul ignore next */
141
- if ( isIOS ( ) ) {
142
- setRootScrollTop ( getRootScrollTop ( ) ) ;
143
- }
136
+ resetScroll ( ) ;
144
137
} ,
145
138
146
139
onClick ( event ) {
Original file line number Diff line number Diff line change 1
1
import { createNamespace , isDef , addUnit } from '../utils' ;
2
- import { getRootScrollTop , setRootScrollTop } from '../utils/dom/scroll' ;
3
- import { isIOS } from '../utils/validate/system' ;
2
+ import { resetScroll } from '../utils/dom/reset-scroll' ;
4
3
5
4
const [ createComponent , bem ] = createNamespace ( 'stepper' ) ;
6
5
@@ -156,12 +155,7 @@ export default createComponent({
156
155
event . target . value = this . currentValue ;
157
156
}
158
157
159
- // Hack for iOS12 page scroll
160
- // https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
161
- /* istanbul ignore next */
162
- if ( isIOS ( ) ) {
163
- setRootScrollTop ( getRootScrollTop ( ) ) ;
164
- }
158
+ resetScroll ( ) ;
165
159
} ,
166
160
167
161
longPressStep ( ) {
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Hack for iOS12 page scroll
3
+ * https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
4
+ */
5
+
6
+ import { isIOS as checkIsIOS } from '../validate/system' ;
7
+ import { getRootScrollTop , setRootScrollTop } from './scroll' ;
8
+
9
+ const isIOS = checkIsIOS ( ) ;
10
+
11
+ /* istanbul ignore next */
12
+ export function resetScroll ( ) {
13
+ if ( isIOS ) {
14
+ setRootScrollTop ( getRootScrollTop ( ) ) ;
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments