|
7 | 7 | :leave-active-class="transitionLeave" |
8 | 8 | > |
9 | 9 | <ul v-show="toggle" class="fab-list"> |
10 | | - <li v-for="action in actions" :style="{ 'background-color': bgColor }" |
11 | | - @click="toParent(action.name)" class="pointer"> |
12 | | - <i class="material-icons">{{action.icon}}</i> |
13 | | - </li> |
| 10 | + <template v-for="action in actions"> |
| 11 | + <transition |
| 12 | + enter-active-class="animated quick zoomIn" |
| 13 | + leave-active-class="animated quick zoomOut" |
| 14 | + > |
| 15 | + <li v-if="toggle" :style="{ 'background-color': bgColor }" |
| 16 | + @click="toParent(action.name)" class="pointer"> |
| 17 | + <i class="material-icons">{{action.icon}}</i> |
| 18 | + </li> |
| 19 | + </transition> |
| 20 | + </template> |
14 | 21 | </ul> |
15 | 22 | </transition> |
16 | 23 | </div> |
17 | 24 | <template v-if="rippleShow"> |
18 | 25 | <div v-ripple="rippleColor == 'light' ? 'rgba(255, 255, 255, 0.35)' : ''" @click="toggle = !toggle" |
19 | 26 | class="fab pointer" :style="{ 'background-color': bgColor }" |
20 | 27 | > |
21 | | - <i class="material-icons md-36" :class="{ rotate: toggle }">add</i> |
| 28 | + <i class="material-icons md-36 main" :class="{ rotate: toggle }">{{mainIcon}}</i> |
| 29 | + <i class="material-icons md-36 close" :class="{ rotate: toggle }">add</i> |
22 | 30 | </div> |
23 | 31 | </template> |
24 | 32 | <template v-else> |
25 | 33 | <div @click="toggle = !toggle" |
26 | 34 | class="fab pointer" :style="{ 'background-color': bgColor, 'z-index': zIndex }" |
27 | 35 | > |
28 | | - <i class="material-icons md-36" :class="{ rotate: toggle }">add</i> |
| 36 | + <i class="material-icons md-36 main" :class="{ rotate: toggle }">{{mainIcon}}</i> |
| 37 | + <i class="material-icons md-36 close" :class="{ rotate: toggle }">add</i> |
29 | 38 | </div> |
30 | 39 | </template> |
31 | 40 | </div> |
|
60 | 69 | rippleColor: { |
61 | 70 | default: 'light' |
62 | 71 | }, |
| 72 | + mainIcon: { |
| 73 | + default: 'add' |
| 74 | + }, |
63 | 75 | actions: {} |
64 | 76 | }, |
65 | 77 | computed: { |
|
87 | 99 | animation() { |
88 | 100 | if (this.position === 'top-right' || this.position === 'top-left') { |
89 | 101 | return { |
90 | | - enter: 'animated fadeInDown', |
91 | | - leave: 'animated fadeOutUp' |
| 102 | + enter: 'animated quick fadeInDown', |
| 103 | + leave: 'animated quick fadeOutUp' |
92 | 104 | }; |
93 | 105 | } else if (this.position === 'bottom-right' || this.position === 'bottom-left') { |
94 | 106 | return { |
95 | | - enter: 'animated fadeInUp', |
96 | | - leave: 'animated fadeOutDown' |
| 107 | + enter: 'animated quick fadeInUp', |
| 108 | + leave: 'animated quick fadeOutDown' |
97 | 109 | }; |
98 | 110 | } else { |
99 | 111 | return { |
|
165 | 177 | </script> |
166 | 178 |
|
167 | 179 | <style scoped> |
| 180 | + .animated.quick { |
| 181 | + -webkit-animation-duration: .7s !important; |
| 182 | + animation-duration: .7s !important; |
| 183 | + } |
| 184 | +
|
168 | 185 | .fab-wrapper { |
169 | 186 | position: fixed; |
170 | 187 | z-index: 999; |
|
190 | 207 | margin: 0px auto; |
191 | 208 | } |
192 | 209 |
|
193 | | - .fab .material-icons.rotate { |
| 210 | + .fab .material-icons.main { |
| 211 | + opacity: 1; |
| 212 | + position: absolute; |
| 213 | + left: .9rem; |
| 214 | + } |
| 215 | +
|
| 216 | + .fab .material-icons.close { |
| 217 | + opacity: 0; |
| 218 | + position: absolute; |
| 219 | + left: .9rem; |
| 220 | + } |
| 221 | +
|
| 222 | + .fab .material-icons.main.rotate { |
| 223 | + -ms-transform: rotate(315deg); /* IE 9 */ |
| 224 | + -webkit-transform: rotate(315deg); /* Chrome, Safari, Opera */ |
| 225 | + transform: rotate(315deg); |
| 226 | + opacity: 0; |
| 227 | + -webkit-transition: opacity .3s ease-in, -webkit-transform .4s; /* Safari */ |
| 228 | + transition: opacity .3s ease-in, transform .4s; |
| 229 | + } |
| 230 | +
|
| 231 | + .fab .material-icons.close.rotate { |
194 | 232 | -ms-transform: rotate(315deg); /* IE 9 */ |
195 | 233 | -webkit-transform: rotate(315deg); /* Chrome, Safari, Opera */ |
196 | 234 | transform: rotate(315deg); |
| 235 | + opacity: 1; |
| 236 | + -webkit-transition: opacity .3s ease-in, -webkit-transform .4s; /* Safari */ |
| 237 | + transition: opacity .3s ease-in, transform .4s; |
197 | 238 | } |
198 | 239 |
|
199 | 240 | .fab-list { |
|
0 commit comments