Vue入門之a(chǎn)nimate過渡動畫效果
簡介:
- transition方法的使用
- transition內(nèi)置方法
- transition-group
animate庫實(shí)現(xiàn)過渡動畫
<!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\vue.js"></script> <link rel="stylesheet" href="lib\animate.css" 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> window.onload = function() { new Vue({ el: '#box', data: { show: '', list: ['apple', 'banana', 'orange', 'pear'] }, computed: { lists: function() { var arr = []; this.list.forEach(function(val) { if (val.indexOf(this.show) != -1) { arr.push(val); } }.bind(this)) return arr; } } }) } </script> </head> <body> <div id="box" v-cloak> <input type="text" v-model="show"> <!-- class定義 .fade .fade-enter{} 初始狀態(tài) .fade-enter-active{} 進(jìn)入過程 .fade-leave{} 離開狀態(tài) .fade-leave-active{} 離開過程 --> <transition-group enter-active-class="zoomInLeft" leave-active-class="bounceOutRight"> <!-- 內(nèi)置方法 @before-enter = "beforeEnter" @enter = "enter" @after-enter = "afterEnter" @before-leave = "beforeLeave" @leave = "leave" @after-leave = "afterLeave" --> <!-- transition-group 多個元素運(yùn)動,注意綁定key:1 --> <p v-show="show" class="animated" v-for="(val, index) in lists" :key="index"> {{val}} </p> </transition-group> </div> </body> </html>
總結(jié)
以上所述是小編給大家介紹的Vue入門之a(chǎn)nimate過渡動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
Element-ui中的Cascader級聯(lián)選擇器基礎(chǔ)用法
這篇文章主要為大家介紹了Element-ui中的Cascader級聯(lián)選擇器基礎(chǔ)用法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-06-06Vue3封裝hooks實(shí)現(xiàn)實(shí)時(shí)獲取麥克風(fēng)音量
這篇文章主要為大家詳細(xì)介紹了Vue3如何通過封裝一個hooks實(shí)現(xiàn)實(shí)時(shí)獲取麥克風(fēng)音量功能,文中的示例代碼講解詳細(xì),需要的小伙伴可以參考一下2024-03-03vue?iview?導(dǎo)航高亮動態(tài)設(shè)置方式
這篇文章主要介紹了vue?iview?導(dǎo)航高亮動態(tài)設(shè)置方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-05-05vue keep-alive 動態(tài)刪除組件緩存的例子
今天小編就為大家分享一篇vue keep-alive 動態(tài)刪除組件緩存的例子,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-11-11echarts3如何清空上一次加載的series數(shù)據(jù)
這篇文章主要介紹了echarts3如何清空上一次加載的series數(shù)據(jù),具有很好的參考價(jià)值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-10-10nginx部署訪問vue-cli搭建的項(xiàng)目的方法
本篇文章主要介紹了nginx部署訪問vue-cli搭建的項(xiàng)目的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-02-02