Skip to content

Commit 1208649

Browse files
committed
fix: Auto complete dropdown flickers #1327
1 parent 88a9845 commit 1208649

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Diff for: components/_util/css-animation/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function clearBrowserBugTimeout(node) {
5454
const cssAnimation = (node, transitionName, endCallback) => {
5555
const nameIsObj = typeof transitionName === 'object';
5656
const className = nameIsObj ? transitionName.name : transitionName;
57-
const activeClassName = nameIsObj ? transitionName.active : `${transitionName}-active`;
57+
const activeClassName = nameIsObj ? transitionName.active : `${transitionName} ${transitionName}-active`;
5858
let end = endCallback;
5959
let start;
6060
let active;
@@ -83,7 +83,10 @@ const cssAnimation = (node, transitionName, endCallback) => {
8383
clearBrowserBugTimeout(node);
8484

8585
nodeClasses.remove(className);
86-
nodeClasses.remove(activeClassName);
86+
activeClassName.split(' ').forEach((className)=>{
87+
nodeClasses.remove(className);
88+
});
89+
//nodeClasses.remove(activeClassName);
8790

8891
Event.removeEndEventListener(node, node.rcEndListener);
8992
node.rcEndListener = null;
@@ -104,7 +107,10 @@ const cssAnimation = (node, transitionName, endCallback) => {
104107

105108
node.rcAnimTimeout = requestAnimationTimeout(() => {
106109
node.rcAnimTimeout = null;
107-
nodeClasses.add(activeClassName);
110+
// nodeClasses.add(activeClassName);
111+
activeClassName.split(' ').forEach((className)=>{
112+
nodeClasses.add(className);
113+
});
108114
if (active) {
109115
requestAnimationTimeout(active, 0);
110116
}

Diff for: components/vc-trigger/Popup.jsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
}),
3131
},
3232
data() {
33+
this.domEl = null;
3334
return {
3435
// Used for stretch
3536
stretchChecked: false,
@@ -43,6 +44,12 @@ export default {
4344
this.setStretchSize();
4445
});
4546
},
47+
beforeUpdate() {
48+
if(this.domEl && this.domEl.rcEndListener) {
49+
this.domEl.rcEndListener();
50+
this.domEl = null;
51+
}
52+
},
4653
updated() {
4754
this.$nextTick(() => {
4855
this.setStretchSize();
@@ -209,19 +216,21 @@ export default {
209216
const transitionEvent = {
210217
beforeEnter: () => {
211218
// el.style.display = el.__vOriginalDisplay
212-
// this.$refs.alignInstance.forceAlign()
219+
// this.$refs.alignInstance.forceAlign();
213220
},
214221
enter: (el, done) => {
215222
// align updated后执行动画
216223
this.$nextTick(() => {
217224
if (this.$refs.alignInstance) {
218225
this.$refs.alignInstance.$nextTick(() => {
226+
this.domEl = el;
219227
animate(el, `${transitionName}-enter`, done);
220228
});
221229
}
222230
});
223231
},
224232
leave: (el, done) => {
233+
this.domEl = null;
225234
animate(el, `${transitionName}-leave`, done);
226235
},
227236
};

0 commit comments

Comments
 (0)