Commit 57ad07f2eabe132394fe64b1ddc295f99e699cb2
Committed by
GitHub
Merge pull request #3172 from huanghong1125/fix-popper
解决dropdown弹出动画异常
Showing
6 changed files
with
37 additions
and
4 deletions
Show diff stats
src/components/cascader/cascader.vue
src/components/date-picker/picker.vue
src/components/dropdown/dropdown.vue
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | @mouseenter="handleMouseenter" |
6 | 6 | @mouseleave="handleMouseleave"> |
7 | 7 | <div :class="[prefixCls + '-rel']" ref="reference" @click="handleClick"><slot></slot></div> |
8 | - <transition :name="transition"> | |
8 | + <transition name="transition-drop"> | |
9 | 9 | <Drop |
10 | 10 | :class="dropdownCls" |
11 | 11 | v-show="currentVisible" | ... | ... |
src/components/select/dropdown.vue
... | ... | @@ -46,6 +46,12 @@ |
46 | 46 | computeStyle:{ |
47 | 47 | gpuAcceleration: false, |
48 | 48 | } |
49 | + }, | |
50 | + onCreate:()=>{ | |
51 | + this.resetTransformOrigin(); | |
52 | + }, | |
53 | + onUpdate:()=>{ | |
54 | + this.resetTransformOrigin(); | |
49 | 55 | } |
50 | 56 | }); |
51 | 57 | }); |
... | ... | @@ -64,6 +70,10 @@ |
64 | 70 | } |
65 | 71 | }, 300); |
66 | 72 | } |
73 | + }, | |
74 | + resetTransformOrigin() { | |
75 | + let placement = this.popper.popper.getAttribute('x-placement').split('-')[0]; | |
76 | + this.popper.popper.style.transformOrigin = placement==='bottom'?'center top':'center bottom'; | |
67 | 77 | } |
68 | 78 | }, |
69 | 79 | created () { | ... | ... |
src/components/select/select.vue
src/styles/animation/slide.less
... | ... | @@ -9,11 +9,34 @@ |
9 | 9 | } |
10 | 10 | } |
11 | 11 | |
12 | +.slide-motion(transition-drop, ivuTransitionDrop); | |
12 | 13 | .slide-motion(slide-up, ivuSlideUp); |
13 | 14 | .slide-motion(slide-down, ivuSlideDown); |
14 | 15 | .slide-motion(slide-left, ivuSlideLeft); |
15 | 16 | .slide-motion(slide-right, ivuSlideRight); |
16 | 17 | |
18 | +@keyframes ivuTransitionDropIn { | |
19 | + 0% { | |
20 | + opacity: 0; | |
21 | + transform: scaleY(0.8); | |
22 | + } | |
23 | + 100% { | |
24 | + opacity: 1; | |
25 | + transform: scaleY(1); | |
26 | + } | |
27 | +} | |
28 | + | |
29 | +@keyframes ivuTransitionDropOut { | |
30 | + 0% { | |
31 | + opacity: 1; | |
32 | + transform: scaleY(1); | |
33 | + } | |
34 | + 100% { | |
35 | + opacity: 0; | |
36 | + transform: scaleY(0.8); | |
37 | + } | |
38 | +} | |
39 | + | |
17 | 40 | @keyframes ivuSlideUpIn { |
18 | 41 | 0% { |
19 | 42 | opacity: 0; | ... | ... |