A plurality of transition elements (setting key) * When the switching elements of the same tag name, to set a unique tag values by key characteristics distinguish them to allow Vue, Vue or only to replace the contents of the internal efficiency of the same label. mode: in-out; out- in
< ! DOCTYPE html>
< html>
< head>
< meta charset= "utf-8" >
< title> Examples< / title>
< style>
. kerwin- enter- active,
. kerwin- leave- active {
transition: all .5 s
}
. kerwin- enter,
. kerwin- leave- to {
opacity: 0 ;
transform: translateX ( 100 px) ;
}
. bounce- enter- active {
animation: bounce- in .5 s;
}
. bounce- leave- active {
animation: bounce- in .5 s reverse;
}
@keyframes bounce- in {
0 % {
transform: translateX ( 100 px) ;
opacity: 0 ;
}
100 % {
transform: translateX ( 0 px) ;
opacity: 1 ;
}
}
< / style>
< / head>
< body>
< div id= "box" >
< button @click= "isShow= !isShow" > click< / button>
< transition name= "bounce" mode= "out-in" >
< p v- if = "isShow" key= "1" > 11111111111 < / p>
< div v- else > tramisu< / div>
< p v- else key= "2" > 222222222 < / p>
< / transition>
< / div>
< script src= "http://cdn.jsdelivr.net/npm/vue/dist/vue.js" > < / script>
< script>
var vm = new Vue ( {
el: "#box" ,
data: {
isShow: true
}
} )
< / script>
< / body>
< / html>