File tree 5 files changed +35
-26
lines changed
5 files changed +35
-26
lines changed Original file line number Diff line number Diff line change @@ -42,20 +42,22 @@ export default {
42
42
renderComponent ( props = { } , ready ) {
43
43
const { visible, forceRender, getContainer, parent } = this ;
44
44
const self = this ;
45
- if ( visible || parent . $refs . _component || forceRender ) {
45
+ if ( visible || parent . _component || parent . $refs . _component || forceRender ) {
46
46
let el = this . componentEl ;
47
47
if ( ! this . container ) {
48
48
this . container = getContainer ( ) ;
49
49
el = document . createElement ( 'div' ) ;
50
50
this . componentEl = el ;
51
51
this . container . appendChild ( el ) ;
52
52
}
53
+ // self.getComponent 不要放在 render 中,会因为响应式数据问题导致,多次触发 render
54
+ const com = { component : self . getComponent ( props ) } ;
53
55
if ( ! this . _component ) {
54
56
this . _component = new this . $root . constructor ( {
55
57
el,
56
58
parent : self ,
57
59
data : {
58
- comProps : props ,
60
+ _com : com ,
59
61
} ,
60
62
mounted ( ) {
61
63
this . $nextTick ( ( ) => {
@@ -72,17 +74,16 @@ export default {
72
74
} ) ;
73
75
} ,
74
76
methods : {
75
- forceRender ( p ) {
76
- this . comProps = p ;
77
- this . $forceUpdate ( ) ;
77
+ setComponent ( _com ) {
78
+ this . $data . _com = _com ;
78
79
} ,
79
80
} ,
80
81
render ( ) {
81
- return self . getComponent ( this . comProps ) ;
82
+ return this . $data . _com . component ;
82
83
} ,
83
84
} ) ;
84
85
} else {
85
- this . _component . forceRender ( props ) ;
86
+ this . _component . setComponent ( com ) ;
86
87
}
87
88
}
88
89
} ,
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ export default {
32
32
visible ( val ) {
33
33
if ( ! val ) {
34
34
this . lastVisible = val ;
35
+ } else {
36
+ this . $nextTick ( ( ) => {
37
+ this . scrollActiveItemToView ( ) ;
38
+ } ) ;
35
39
}
36
40
} ,
37
41
} ,
@@ -50,11 +54,11 @@ export default {
50
54
} ,
51
55
updated ( ) {
52
56
const props = this . $props ;
53
- if ( ! this . prevVisible && props . visible ) {
54
- this . $nextTick ( ( ) => {
55
- this . scrollActiveItemToView ( ) ;
56
- } ) ;
57
- }
57
+ // if (!this.prevVisible && props.visible) {
58
+ // this.$nextTick(() => {
59
+ // this.scrollActiveItemToView();
60
+ // });
61
+ // }
58
62
this . lastVisible = props . visible ;
59
63
this . lastInputValue = props . inputValue ;
60
64
this . prevVisible = this . visible ;
Original file line number Diff line number Diff line change @@ -828,11 +828,10 @@ const Select = {
828
828
// When set open success and single mode,
829
829
// we will reset the input content.
830
830
if ( open && ! multiple && ! treeCheckable && _searchValue ) {
831
- // 动画会有闪动,该特性先注释
832
- // this.setUncontrolledState({
833
- // _searchValue: '',
834
- // _filteredTreeNodes: null,
835
- // });
831
+ this . setUncontrolledState ( {
832
+ _searchValue : '' ,
833
+ _filteredTreeNodes : null ,
834
+ } ) ;
836
835
}
837
836
this . setOpenState ( open , true ) ;
838
837
} ,
Original file line number Diff line number Diff line change @@ -46,12 +46,14 @@ export default {
46
46
this . setStretchSize ( ) ;
47
47
} ) ;
48
48
} ,
49
- beforeUpdate ( ) {
50
- if ( this . domEl && this . domEl . rcEndListener ) {
51
- this . domEl . rcEndListener ( ) ;
52
- this . domEl = null ;
53
- }
54
- } ,
49
+ // 如添加会导致动画失效,如放开会导致快速输入时闪动 https://github.com/vueComponent/ant-design-vue/issues/1327,
50
+ // 目前方案是保留动画,闪动问题(动画多次执行)进一步定位
51
+ // beforeUpdate() {
52
+ // if (this.domEl && this.domEl.rcEndListener) {
53
+ // this.domEl.rcEndListener();
54
+ // this.domEl = null;
55
+ // }
56
+ // },
55
57
updated ( ) {
56
58
this . $nextTick ( ( ) => {
57
59
this . setStretchSize ( ) ;
@@ -207,10 +209,10 @@ export default {
207
209
style : { ...sizeStyle , ...popupStyle , ...this . getZIndexStyle ( ) } ,
208
210
} ;
209
211
let transitionProps = {
210
- props : Object . assign ( {
212
+ props : {
211
213
appear : true ,
212
214
css : false ,
213
- } ) ,
215
+ } ,
214
216
} ;
215
217
const transitionName = getTransitionName ( ) ;
216
218
let useTransition = ! ! transitionName ;
@@ -227,6 +229,8 @@ export default {
227
229
this . domEl = el ;
228
230
animate ( el , `${ transitionName } -enter` , done ) ;
229
231
} ) ;
232
+ } else {
233
+ done ( ) ;
230
234
}
231
235
} ) ;
232
236
} ,
Original file line number Diff line number Diff line change @@ -128,9 +128,10 @@ export default {
128
128
if ( this . sPopupVisible !== this . prevPopupVisible ) {
129
129
this . afterPopupVisibleChange ( this . sPopupVisible ) ;
130
130
}
131
+ this . prevPopupVisible = this . sPopupVisible ;
131
132
} ;
133
+ this . renderComponent ( null , triggerAfterPopupVisibleChange ) ;
132
134
this . $nextTick ( ( ) => {
133
- this . renderComponent ( null , triggerAfterPopupVisibleChange ) ;
134
135
this . updatedCal ( ) ;
135
136
} ) ;
136
137
} ,
You can’t perform that action at this time.
0 commit comments