You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
833 B
35 lines
833 B
import animate from './css-animation';
|
|
const noop = () => {};
|
|
const getTransitionProps = (transitionName, opt = {}) => {
|
|
const { beforeEnter, enter, afterEnter, leave, afterLeave, appear = true, tag, nativeOn } = opt;
|
|
const transitionProps = {
|
|
props: {
|
|
appear,
|
|
css: false,
|
|
},
|
|
on: {
|
|
beforeEnter: beforeEnter || noop,
|
|
enter:
|
|
enter ||
|
|
((el, done) => {
|
|
animate(el, `${transitionName}-enter`, done);
|
|
}),
|
|
afterEnter: afterEnter || noop,
|
|
leave:
|
|
leave ||
|
|
((el, done) => {
|
|
animate(el, `${transitionName}-leave`, done);
|
|
}),
|
|
afterLeave: afterLeave || noop,
|
|
},
|
|
nativeOn,
|
|
};
|
|
// transition-group
|
|
if (tag) {
|
|
transitionProps.tag = tag;
|
|
}
|
|
return transitionProps;
|
|
};
|
|
|
|
export default getTransitionProps;
|