Hello again,
I decided to symplify my approach totally...
So I changed the Modal.vue model to this following example.
Tell me if you know a way to simplify Velocity animation because I tried the sequences from the velocity.ui add-on, bug it's not working as intended... It do not wait until the end of the animation to hide... So I think there was an issue there in my programming.
Anyway, I need advices on my coding so feel free to give me any feedback :)
Kind regard.
<template>
<transition :css="false" @enter="enter" @leave="leave">
<div class="modal is-active" v-if="modalStatus">
<div class="modal-background" @click.prevent="close"></div>
<div class="modal-card" ref="mod">
<header class="modal-card-head">
<p class="modal-card-title">
<slot name="title">Mentions légales</slot>
</p>
<button class="delete" @click.prevent="close"></button>
</header>
<section class="modal-card-body">
<div class="content">
<slot></slot>
</div>
</section>
</div>
</div>
</transition>
</template>
<script>
export default {
props: ['show'],
data() {
return {
animParams: {
duration: 1000,
easing: [0.39, 0.67, 0.04, 0.98]
}
}
},
computed: {
modalStatus() {
return this.show;
}
},
methods: {
close() {
this.$emit('close', true);
},
enter(el, done) {
Velocity(
el,
{
opacity: [1,0]
},
{
duration: 1000,
easing: [0.39, 0.67, 0.04, 0.98]
}
);
Velocity(
this.$refs.mod,
{
translateY: ['0%', '-100%']
},
{
duration: 1000,
easing: [0.39, 0.67, 0.04, 0.98],
complete() { done ()}
}
)
},
leave(el, done) {
Velocity(
el,
{
opacity: [0,1]
},
{
duration: 500,
easing: [0.39, 0.67, 0.04, 0.98]
}
);
Velocity(
this.$refs.mod,
{
translateY: ['100%', '0%']
},
{
duration: 1000,
easing: [0.39, 0.67, 0.04, 0.98],
complete() { done ()}
}
)
}
},
}
</script>