https://segmentfault.com/a/1190000018125564 很完善了,重点是两个过程图。
<style> .fade-enter{ opacity:; } .fade-enter-active{ transition: opacity 3s; } /* .fade-enter-to{ color: red; } .fade-leave{ color: green; } */ .fade-leave-to{ opacity:; } .fade-leave-active{ transition: opacity 3s; } </style> </head> <body> <!-- 过程如下: 显示 fade-enter,fade-enter-active fade-enter-active,fade-enter-to 空 隐藏 fade-leave,fade-leave-active fade-leave-active,fade-leave-to 空 --> <div id="root"> <transition name='fade'> <h1 v-show='show'> 最是年少时模样 </h1> </transition> <button @click='change'>切换</button> </div> <script> var vm=new Vue({ el:'#root', data:{ show:true }, methods:{ change:function(){ this.show=!this.show; } } }) </script> </body>
版权声明:除特别声明外,本站所有文章皆是本站原创,转载请以超链接形式注明出处!