Merge pull request #3172 from huanghong1125/fix-popper

解决dropdown弹出动画异常
This commit is contained in:
Aresn 2018-03-16 09:39:34 +08:00 committed by GitHub
commit 57ad07f2ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 4 deletions

View file

@ -20,7 +20,7 @@
<Icon type="arrow-down-b" :class="[prefixCls + '-arrow']"></Icon> <Icon type="arrow-down-b" :class="[prefixCls + '-arrow']"></Icon>
</slot> </slot>
</div> </div>
<transition name="slide-up"> <transition name="transition-drop">
<Drop <Drop
v-show="visible" v-show="visible"
:class="{ [prefixCls + '-transfer']: transfer }" :class="{ [prefixCls + '-transfer']: transfer }"

View file

@ -23,7 +23,7 @@
></i-input> ></i-input>
</slot> </slot>
</div> </div>
<transition :name="transition"> <transition name="transition-drop">
<Drop <Drop
@click.native="handleTransferClick" @click.native="handleTransferClick"
v-show="opened" v-show="opened"

View file

@ -5,7 +5,7 @@
@mouseenter="handleMouseenter" @mouseenter="handleMouseenter"
@mouseleave="handleMouseleave"> @mouseleave="handleMouseleave">
<div :class="[prefixCls + '-rel']" ref="reference" @click="handleClick"><slot></slot></div> <div :class="[prefixCls + '-rel']" ref="reference" @click="handleClick"><slot></slot></div>
<transition :name="transition"> <transition name="transition-drop">
<Drop <Drop
:class="dropdownCls" :class="dropdownCls"
v-show="currentVisible" v-show="currentVisible"

View file

@ -46,6 +46,12 @@
computeStyle:{ computeStyle:{
gpuAcceleration: false, gpuAcceleration: false,
} }
},
onCreate:()=>{
this.resetTransformOrigin();
},
onUpdate:()=>{
this.resetTransformOrigin();
} }
}); });
}); });
@ -64,6 +70,10 @@
} }
}, 300); }, 300);
} }
},
resetTransformOrigin() {
let placement = this.popper.popper.getAttribute('x-placement').split('-')[0];
this.popper.popper.style.transformOrigin = placement==='bottom'?'center top':'center bottom';
} }
}, },
created () { created () {

View file

@ -35,7 +35,7 @@
<Icon type="arrow-down-b" :class="[prefixCls + '-arrow']" v-if="!remote"></Icon> <Icon type="arrow-down-b" :class="[prefixCls + '-arrow']" v-if="!remote"></Icon>
</slot> </slot>
</div> </div>
<transition :name="transitionName"> <transition name="transition-drop">
<Drop <Drop
:class="dropdownCls" :class="dropdownCls"
v-show="dropVisible" v-show="dropVisible"

View file

@ -9,11 +9,34 @@
} }
} }
.slide-motion(transition-drop, ivuTransitionDrop);
.slide-motion(slide-up, ivuSlideUp); .slide-motion(slide-up, ivuSlideUp);
.slide-motion(slide-down, ivuSlideDown); .slide-motion(slide-down, ivuSlideDown);
.slide-motion(slide-left, ivuSlideLeft); .slide-motion(slide-left, ivuSlideLeft);
.slide-motion(slide-right, ivuSlideRight); .slide-motion(slide-right, ivuSlideRight);
@keyframes ivuTransitionDropIn {
0% {
opacity: 0;
transform: scaleY(0.8);
}
100% {
opacity: 1;
transform: scaleY(1);
}
}
@keyframes ivuTransitionDropOut {
0% {
opacity: 1;
transform: scaleY(1);
}
100% {
opacity: 0;
transform: scaleY(0.8);
}
}
@keyframes ivuSlideUpIn { @keyframes ivuSlideUpIn {
0% { 0% {
opacity: 0; opacity: 0;