vuepress-theme-reco/components/ModuleTransition.vue
reco_luan f8a39a9755 reactor: refacor load tansition
refacor load tansition by ModuleTransition.vue
2019-12-06 00:11:16 +08:00

46 lines
802 B
Vue

<template>
<transition
name="module"
@enter="setStyle"
@after-enter="unsetStyle"
@before-leave="setStyle">
<slot />
</transition>
</template>
<script>
export default {
name: 'ModuleTransition',
props: {
delay: {
type: String,
default: '0'
},
duration: {
type: String,
default: '.25'
}
},
methods: {
setStyle (items) {
items.style.transition = `all ${this.duration}s ease-in-out ${this.delay}s`
items.style.transform = 'translateY(-20px)'
items.style.opacity = 0
},
unsetStyle (items) {
items.style.transform = 'translateY(0)'
items.style.opacity = 1
}
}
}
</script>
<style lang="stylus">
.module-enter, .module-leave-to {
opacity: 0;
transform:translateY(-20px);
}
</style>