Created
March 5, 2018 14:06
-
-
Save davision/56f1f594ce4d62f45d2787962ffdb904 to your computer and use it in GitHub Desktop.
Encapsulated wrapper transition component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<transition name="fade" v-bind="$attrs" v-on="$listeners"> | |
<slot></slot> | |
</transition> | |
</template> | |
<script> | |
export default {}; | |
</script> | |
<style> | |
.fade-enter-active, | |
.fade-leave-active { | |
transition: opacity 0.3s; | |
} | |
.fade-enter, | |
.fade-leave-to { | |
opacity: 0; | |
} | |
</style> | |
... | |
<fade-transition mode="out-in"> | |
<div key="blue" v-if="show" class="box"></div> | |
<div key="red" v-else class="red-box"></div> | |
</fade-transition> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment