mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-04 13:08:48 +08:00
29 lines
709 B
JavaScript
29 lines
709 B
JavaScript
import animate from './css-animation'
|
|
const noop = () => {}
|
|
const getTransitionProps = (transitionName, opt = {}) => {
|
|
const { beforeEnter, enter, leave, afterLeave, appear = true, tag } = opt
|
|
const transitionProps = {
|
|
props: {
|
|
appear,
|
|
css: false,
|
|
},
|
|
on: {
|
|
beforeEnter: beforeEnter || noop,
|
|
enter: enter || ((el, done) => {
|
|
animate(el, `${transitionName}-enter`, done)
|
|
}),
|
|
leave: leave || ((el, done) => {
|
|
animate(el, `${transitionName}-leave`, done)
|
|
}),
|
|
afterLeave: afterLeave || noop,
|
|
},
|
|
}
|
|
// transition-group
|
|
if (tag) {
|
|
transitionProps.tag = tag
|
|
}
|
|
return transitionProps
|
|
}
|
|
|
|
export default getTransitionProps
|