Vue: Suggestion:directly declared enter class and leave class in transition definition

Created on 3 Dec 2015  路  11Comments  路  Source: vuejs/vue

when using other lib like animate.css, can't integration easy with Vue.

expect this

<div v-show="showFlag" transition="transitionId:transitionEnter,transitionLeave">

for integration with animate.css

<div v-show="showFlag" transition="transitionId:bounceInRight,bounceOutRight">
feature request intend to implement

All 11 comments

Sounds like a useful option...

How about we define it in a transition object:

Vue.transition('bounce', {
  enterClass: 'bounceInRight',
  leaveClass: 'bounceOutRight'
})
<div v-show="showFlag" transition="bounce">

Of course, but use a little complicated.

Alternatively:

<div v-show="showFlag" :transition="{ enterClass: 'bounceInRight', leaveClass: 'bounceOutRight' }">

Great, enough for me. but how provide js hook?

<div v-show="showFlag" :transition="{
  name: 'bounce',
  enterClass: 'bounceInRight',
  leaveClass: 'bounceOutRight'
}">

You can define enterClass and leaveClass either inline, or in the JavaScript definition.

How about enterClass and leaveClass can also pass as function, since some times need random transitions or any other needs custom logic situation. @yyx990803

@dsonet computed variables probably should work.

@OEvgeny Thanks for your reply, I didn't try the way you mentioned yet, but it seems has to be inline. What I want is also can do that with Vue.transition to make it reusable.

@yyx990803 Do you have any plan to make enterClass and leaveClass dynamic? For example, in a carousel, a slide may slide from both left and right. If I assign a vue transition to a slide, its enter and leave classes will be unchangeable. It will slide from either left OR right. But in this case, we need to assign dynamic classes.

By the way, thanks for the great work!

Will this be implemented in 2.0.0? I see it works in 1.0.14 and up, but not in 2.0.0 alpha.

This is supported in 1.0.14+ and 2.0 (as props to <transition>)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yyx990803 picture yyx990803  路  210Comments

RashadSaleh picture RashadSaleh  路  51Comments

ShuvoHabib picture ShuvoHabib  路  40Comments

smolinari picture smolinari  路  116Comments

chrisvfritz picture chrisvfritz  路  46Comments