-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add layout transitions #1620
add layout transitions #1620
Conversation
Thanks, @homerjam ! Would you please enable some layer transitions in tests/fixtures/with-config? There is no coverage to test template conditions now. |
return +to.query.page < +from.query.page ? 'slide-right' : 'slide-left' | ||
}, | ||
async asyncData ({ query }) { | ||
const page = +query.page || 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick to handle nulls :D But doesn't it always resolve to 1
(I mean 0 or null are both falsy values) so maybe can be simplified without +
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup you're almost certainly right : )
I copied the example from route transitions!
|
437f01c
to
ad09857
Compare
Hi @pi0 I've added the In future it'd obviously be great to be able to override the |
@@ -1,6 +1,8 @@ | |||
<template> | |||
<nuxt-error v-if="nuxt.err" :error="nuxt.err"></nuxt-error> | |||
<nuxt-child :key="routerViewKey" v-else></nuxt-child> | |||
<div class="nuxt"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to wrap these components to fix page transitions ¯_(ツ)_/¯
@@ -1,7 +1,9 @@ | |||
<template> | |||
<div id="__nuxt"> | |||
<% if (loading) { %><nuxt-loading ref="loading"></nuxt-loading><% } %> | |||
<component v-if="layout" :is="nuxt.err ? 'nuxt' : layout"></component> | |||
<% if (layoutTransition) { %><transition name="<%= layoutTransition.name %>" mode="<%= layoutTransition.mode %>"><% } %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should always add the <transition>
if we want to be able to add layoutTransition into layouts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean we should always have <transition>
even if no layoutTransition
is set (so remove the conditional render from the template)?
Or do you mean the <transition>
should be added by the user into layout template? This would present an issue with the way layouts work at the moment. The only resolution would be a programatic transition, similar to the one used by pages in nuxt-child
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean always transition and have default layout transition (like for pages, so the user can add .layout-enter { ... }
in css to add an animation :))
Hi @homerjam I tried indeed to add layout transition but I had the same result as you, the page transitions were broken too. Could you also see my review and see why the tests are failing? |
@Atinux The page transitions are working now - I spent hours trying different things before finally wrapping the nuxt-child and nuxt-error components which fixed it. AFAIK the tests are failing because of a separate issue:
I had a quick look and it seems like that test needs some attention, it's broken running against current dev branch. |
I will do more tests on it, you did an amazing job there @homerjam |
Awesome! Thanks for merging. Should I alter the conditional |
I'll do it :) |
Any updates on getting this released soon? |
You can use it now if you install from github!
…On 20 Oct 2017 17:48, "Harry Manchanda" ***@***.***> wrote:
Any updates on getting this released soon?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1620 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABAcGb2EpYCLWTcGt0BA6a_8Anoi7aHBks5suM7OgaJpZM4PRdYB>
.
|
@homerjam I trace the layout transition issue to here. |
@ckpiggy |
Oh and you probably want to use the starter project for initial setup - that will create pages directory etc |
Hey @homerjam is there still something special that needs to be done for this after v1.0? I'm having trouble getting this working. |
It should be working (I’ve tested and it does for me). Can you post a minimal version of what you have that’s failing?
…On 19 Jan 2018, 20:03 +0000, Chase Whiteside ***@***.***>, wrote:
Hey @homerjam is there still something special that needs to be done for this after v1.0? I'm having trouble getting this working.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yeah sorry, somehow I missed that the I did notice something though. When using both layout and page transitions, the For now I think I've solved it with
Why that's happening makes sense, now that I know... but I can't think of any reason it would be an intended behavior. So I wonder if there's not some easy way to fix that by default. That's my first time working with nested transitions. Edit: Forgot to also ask, am I correct that you cannot set the layout transition in each layout? That's unfortunate if true, because then you can't adjust the transition hooks conditionally. If we can only set it in the nuxt.config, as far as I can tell, there's no way to access the vuex state there? Which means the transition has no awareness of the rest of the app. Very limiting when compared to page transitions. |
@chasebank could be related to #1737 - I have a very similar issue in one of my projects when using nuxt-child. I think the solution will be to somehow prevent the nested transitions from running - perhaps adding a hook to the nuxt/nuxt-child components to check if there is an active parent transition. |
Apparently there used to be |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR introduces layout transitions (#1519). It would be great to get some feedback/input to get them sorted.