Introduction:
- Use of transition method
- Built-in transition method
- transition-group
Animate library implements transition animation
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="lib\"></script> <link rel="stylesheet" href="lib\" rel="external nofollow" > <style> [v-cloak] { display: none; } p { width: 100px; height: 100px; background: red; margin: 10px auto; } /* .fade-enter-active, .fade-leave-active { transition: 1s all ease; } .fade-enter-active { opacity: 1; width: 300px; height: 300px; } .fade-leave-active { opacity: 0; width: 100px; height: 100px; } .fade-enter, .fade-leave { width: 100px; height: 100px; opacity: 0; } */ </style> <script> = function() { new Vue({ el: '#box', data: { show: '', list: ['apple', 'banana', 'orange', 'pear'] }, computed: { lists: function() { var arr = []; (function(val) { if (() != -1) { (val); } }.bind(this)) return arr; } } }) } </script> </head> <body> <div v-cloak> <input type="text" v-model="show"> <!-- classdefinition .fade .fade-enter{} Initial status .fade-enter-active{} Enter the process .fade-leave{} Leave status .fade-leave-active{} Leaving process --> <transition-group enter-active-class="zoomInLeft" leave-active-class="bounceOutRight"> <!-- Built-in method @before-enter = "beforeEnter" @enter = "enter" @after-enter = "afterEnter" @before-leave = "beforeLeave" @leave = "leave" @after-leave = "afterLeave" --> <!-- transition-group Multiple elements movement,Pay attention to bindingkey:1 --> <p v-show="show" class="animated" v-for="(val, index) in lists" :key="index"> {{val}} </p> </transition-group> </div> </body> </html>
Summarize
The above is the introduction to Vue animate transition animation effect introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!