Reputation: 4282
I'm trying to apply a transition whether a component has to be shown or not. I'm wondering why this simple example is not working: http://jsfiddle.net/bf830qoq/
Vue.component('loading', {
template: '#loading-template',
});
new Vue({
el: '#app',
data: {
showLoging: false
}
});
<script type="x/template" id="loading-template">
<transition="slide-fade">
<div>Loading</div>
</transition>
</script>
<!-- app -->
<div id="app">
<loading v-if='showLoging'></loading>
<button id="show-login" @click="showLoging = !showLoging">Show</button>
</div>
.slide-fade-enter-active {
transition: all .3s ease;
}
.slide-fade-leave-active {
transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active for <2.1.8 */ {
transform: translateX(10px);
opacity: 0;
}
Upvotes: 0
Views: 3398
Reputation: 73619
Your syntax is wrong, you have to use name attribute for transition, like following:
<transition name="slide-fade" mode="in-out">
<div>Loading</div>
</transition>
See working fiddle.
Upvotes: 3
Reputation: 2555
There's a typo in your template as it is invalid right now
<script type="x/template" id="loading-template">
<transition="slide-fade">
<div>Loading</div>
</transition>
</script>
should have the name property written properly
<script type="x/template" id="loading-template">
<transition name="slide-fade">
<div>Loading</div>
</transition>
</script>
Upvotes: 1