Comments (12)
No worries. I cooked up a rough CodeSandbox illustrating how I might go about building such a
UI. Note that the transitions themselves are super rough, and you'd definitely need to go back and add inverseFlipId
s to ensure that the right elements are transitioning into place. Alex (the author of react-flip-toolkit
does a great job of explaining how this works in her README.
https://codesandbox.io/s/vue-template-qw928
The main difference in our respective implementations is that I've decided to wrap the entire app in a Router
that's also wrapped in a Flipper
. Each screen – Home, Chat List, Chat Detail – is a Vue component inside of which lives a Flipped
component with the same ID. That ensures that each "route" triggers some Flip animation.
from vue-flip-toolkit.
from vue-flip-toolkit.
Here is the CodeSandbox: https://codesandbox.io/s/vue-template-1pj6t
The "simple" instance that I am referring to is in the "Chat" component.
The router instance is in the ChatWrapper, ChatIndex, and ChatConversation components.
from vue-flip-toolkit.
This one is super interesting. I have a theory as to why your code isn't working, though.
I noticed that in all of my examples, the Flipped
components were wrapping plain old HTML nodes, e.g.,
<Flipped flipId="foo">
<div class="foo">Foo</div>
</Flipped>
In your examples, however, the Flipped components
are wrapping actual Vue components, e.g.,
<Flipped :flipId="key">
<chat-button />
</Flipped>
In the React Flip Toolkit docs, the author Alex calls out having to use React's "render props" API to ensure that the rendered child receives all of the right attributes from the Flip library, such that a transition can occur. These attributes – namely the inline styles – are missing from your examples, and hence the lack of transition.
My suggestion – and I think it will work, as I just did a quick experiment on my end – is to change your markup such that the Flipped
instances live inside your custom components, not outside as they currently do. So, you end up with something like this –
<!-- Chat.vue (OLD WAY) -->
<Flipped :flipId="key" v-if="!visible">
<chat-button />
</Flipped>
<!-- Chat.vue (NEW WAY) -->
<chat-button v-if="visible" />
<!-- ChatButton.vue (NEW WAY) -->
<template>
<Flipped :flipId="key" v-if="!visible">
<div>Button markup goes here</div>
</Flipped>
</template>
Let me know if this does the trick. I can't tell whether I need to go back to the drawing board on this one so support this pretty common use case.
from vue-flip-toolkit.
Thanks a bunch for the feedback. I have made the requested updates. I think we are making progress. The button that shows and minimizes the chat window works like a charm. However for the life of me, I have not been able to get the router to work.
I have updated the sandbox accordingly: https://codesandbox.io/s/vue-template-1pj6t
from vue-flip-toolkit.
I don't fully understand what's not working.
When you say "the router," what do you mean? What animation or general behavior do you expect to see that isn't working?
from vue-flip-toolkit.
Sorry, I should have been clearer. The router itself works fine, but the transitions from index page to the child pages are not working.
from vue-flip-toolkit.
@dniccum Can I close out this issue?
from vue-flip-toolkit.
@mattrothenberg Sorry that I didn't get back to you. Yes this approach seemed to have fixed a lot of my issues. I need to clean up some of the animations with the available event listeners but you have put me on the right track. Thanks for your help.
from vue-flip-toolkit.
@dniccum No problem. Good luck!
from vue-flip-toolkit.
I've just digged through this issue and it helped me a lot with my project as well!
@mattrothenberg I think you should emphase this in docs, because it's really valuable info!
from vue-flip-toolkit.
@kedrzu Glad it helped. Feel free to add something to the README so that others can take advantage of that knowledge!
from vue-flip-toolkit.
Related Issues (15)
- Failed to mount component: template or render function not defined. HOT 1
- Nuxt? HOT 2
- Compatibility with Edge HOT 5
- Cannot set property 'flipId' of undefined HOT 12
- Can staggerConfig props be reactive ? HOT 5
- Examples: Isn't it better to have props in kebab-case? HOT 1
- nuxt route transition HOT 9
- inverseFlipId transition not work properly in v-for loop HOT 12
- Flex-direction can't be animated HOT 3
- Vue 3 support HOT 1
- Unexpected behavior when using display: fixed; HOT 7
- Vue 3 Support HOT 5
- add support for event emit instead of flipKey HOT 1
- License needed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-flip-toolkit.