0

I cant add animation using transition or transition-group. I have code:

    <transition mode="out-in" enter-active-class="animated zoomIn" leave-active-class="animated zoomOut">
        <div key=1 v-if="$route.name !== null">
            <router-view></router-view>
        </div>
        <div v-else key=2>
            <p>First text</p>
            <p>Second text</p>
        </div>
    </transition>

the change does not help from transtition to transition-group. Transition should surround:

<div v-if="$route.name !== null">
   <router-view></router-view>
</div>

and

<p>First tex</p>
<p>Second text</p>
1
  • I want to confirm that you do see "First text" and "Second text" without the animation, since null is quite an odd thing to have as a name. I would expect it to be either undefined or a string. Commented Jan 3, 2019 at 19:50

1 Answer 1

2

I found solution. I used transition two times. I do not know if I should do it, but it works now.

    <transition mode="out-in" enter-active-class="animated zoomIn" leave-active-class="animated zoomOut">
        <div key="save" v-if="$route.name !== null">
             <transition mode="out-in" enter-active-class="animated zoomIn" leave-active-class="animated zoomOut">
            <router-view></router-view>
            </transition>
        </div>
        <div v-else key="edit">
           <p>First tex</p>
           <p>Second text</p>
        </div>
    </transition>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.