feat: update transition util
parent
f2af8d248e
commit
e2ce58fa7a
|
@ -1,33 +1,16 @@
|
||||||
import animate from './css-animation';
|
import animate from './css-animation';
|
||||||
const noop = () => {};
|
|
||||||
const getTransitionProps = (transitionName, opt = {}) => {
|
const getTransitionProps = (transitionName, opt = {}) => {
|
||||||
const { beforeEnter, enter, afterEnter, leave, afterLeave, appear = true, tag, nativeOn } = opt;
|
|
||||||
const transitionProps = {
|
const transitionProps = {
|
||||||
props: {
|
appear: true,
|
||||||
appear,
|
|
||||||
css: false,
|
css: false,
|
||||||
},
|
onEnter: (el, done) => {
|
||||||
on: {
|
|
||||||
beforeEnter: beforeEnter || noop,
|
|
||||||
enter:
|
|
||||||
enter ||
|
|
||||||
((el, done) => {
|
|
||||||
animate(el, `${transitionName}-enter`, done);
|
animate(el, `${transitionName}-enter`, done);
|
||||||
}),
|
|
||||||
afterEnter: afterEnter || noop,
|
|
||||||
leave:
|
|
||||||
leave ||
|
|
||||||
((el, done) => {
|
|
||||||
animate(el, `${transitionName}-leave`, done);
|
|
||||||
}),
|
|
||||||
afterLeave: afterLeave || noop,
|
|
||||||
},
|
},
|
||||||
nativeOn,
|
onLeave: (el, done) => {
|
||||||
|
animate(el, `${transitionName}-leave`, done);
|
||||||
|
},
|
||||||
|
...opt,
|
||||||
};
|
};
|
||||||
// transition-group
|
|
||||||
if (tag) {
|
|
||||||
transitionProps.tag = tag;
|
|
||||||
}
|
|
||||||
return transitionProps;
|
return transitionProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue