ktquez / vue-extend-layout

Default layout or create custom layouts for the pages of your Vue.js SPA (Multiple layouts)
https://vue-layouts2.surge.sh/
MIT License
131 stars 16 forks source link

Transition component does not trigger leave classes. #17

Closed michaelpumo closed 6 years ago

michaelpumo commented 6 years ago

I am using the new version 2 of your plugin.

In my App.vue, I have the following:

<template>
  <div id="app" class="Layout">
    <transition name="Layout__router" mode="out-in">
      <vue-extend-layouts />
    </transition>
  </div>
</template>

<script>
import VueExtendLayouts from 'vue-extend-layout'

export default {
  name: 'App',
  components: {
    VueExtendLayouts
  }
}
</script>

<style lang="scss">
.Layout {
  &__router {
    &-enter-active,
    &-leave-active {
      transition: all 1s;
    }
    &-enter-active {
      transition-delay: 1s;
    }
    &-enter,
    &-leave-to {
      opacity: 0;
      pointer-events: none;
    }
  }
}
</style>

This should happily fade out the route and then fade in on the new route.

However, the transition component is only fading in once the route has entered. No animation / classes are triggered for leaving the route so far as I can see.

Is this an issue with your plugin? It's difficult to determine.

Thanks Michael

ktquez commented 6 years ago

I'll run a test with transitions. Have you tried the transitions inside the layouts?

michaelpumo commented 6 years ago

Thanks @ktquez.

Yes, I just tried that too; moving the transition into each respective layout but when doing that, nothing happens at all.

ktquez commented 6 years ago

Usually it uses the "meta" of the route to modify the layout. That must be why.

michaelpumo commented 6 years ago

How do you mean it uses the meta? Is that related to vue-meta plugin?

If you have it working it’d be great to see an example up on the docs.

ktquez commented 6 years ago

Setting layout by meta object: https://github.com/ktquez/vue-extend-layout/blob/master/example/src/router.js#L20

Choosing which layout will be loaded: https://github.com/ktquez/vue-extend-layout/blob/master/vue-extend-layout.vue#L23

michaelpumo commented 6 years ago

Ahh yes I see now. I might submit a PR to handle this then, if you're welcoming them?

ktquez commented 6 years ago

@michaelpumo Yes, I would be grateful for a PR

shirshak55 commented 6 years ago

yea anyway to handle this transition as it is not working properly. I used to keep transition wrapping router-view . But it seems this package re renders every time making transition not possible.

ktquez commented 6 years ago

@michaelpumo Could you reproduce an example online?

ktquez commented 6 years ago

@michaelpumo @shirshak55 With the corrections of @shirshak55 you could test whether the transitions now work.

ktquez commented 6 years ago

Anything new will open again.