Skip to content

Commit

Permalink
fix: Auto complete dropdown flickers #1327
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Oct 24, 2019
1 parent 88a9845 commit 1208649
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions components/_util/css-animation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function clearBrowserBugTimeout(node) {
const cssAnimation = (node, transitionName, endCallback) => {
const nameIsObj = typeof transitionName === 'object';
const className = nameIsObj ? transitionName.name : transitionName;
const activeClassName = nameIsObj ? transitionName.active : `${transitionName}-active`;
const activeClassName = nameIsObj ? transitionName.active : `${transitionName} ${transitionName}-active`;
let end = endCallback;
let start;
let active;
Expand Down Expand Up @@ -83,7 +83,10 @@ const cssAnimation = (node, transitionName, endCallback) => {
clearBrowserBugTimeout(node);

nodeClasses.remove(className);
nodeClasses.remove(activeClassName);
activeClassName.split(' ').forEach((className)=>{
nodeClasses.remove(className);
});
//nodeClasses.remove(activeClassName);

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

node.rcAnimTimeout = requestAnimationTimeout(() => {
node.rcAnimTimeout = null;
nodeClasses.add(activeClassName);
// nodeClasses.add(activeClassName);
activeClassName.split(' ').forEach((className)=>{
nodeClasses.add(className);
});
if (active) {
requestAnimationTimeout(active, 0);
}
Expand Down
11 changes: 10 additions & 1 deletion components/vc-trigger/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
}),
},
data() {
this.domEl = null;
return {
// Used for stretch
stretchChecked: false,
Expand All @@ -43,6 +44,12 @@ export default {
this.setStretchSize();
});
},
beforeUpdate() {
if(this.domEl && this.domEl.rcEndListener) {
this.domEl.rcEndListener();
this.domEl = null;
}
},
updated() {
this.$nextTick(() => {
this.setStretchSize();
Expand Down Expand Up @@ -209,19 +216,21 @@ export default {
const transitionEvent = {
beforeEnter: () => {
// el.style.display = el.__vOriginalDisplay
// this.$refs.alignInstance.forceAlign()
// this.$refs.alignInstance.forceAlign();
},
enter: (el, done) => {
// align updated后执行动画
this.$nextTick(() => {
if (this.$refs.alignInstance) {
this.$refs.alignInstance.$nextTick(() => {
this.domEl = el;
animate(el, `${transitionName}-enter`, done);
});
}
});
},
leave: (el, done) => {
this.domEl = null;
animate(el, `${transitionName}-leave`, done);
},
};
Expand Down

0 comments on commit 1208649

Please sign in to comment.