Vue入門之a(chǎn)nimate過渡動畫效果
更新時間:2018年04月08日 14:34:45 作者:銳小6
這篇文章主要介紹了Vue入門之a(chǎn)nimate過渡動畫效果的相關資料,需要的朋友可以參考下
簡介:
- transition方法的使用
- transition內(nèi)置方法
- transition-group
animate庫實現(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{} 進入過程
.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 多個元素運動,注意綁定key:1 -->
<p v-show="show" class="animated" v-for="(val, index) in lists" :key="index">
{{val}}
</p>
</transition-group>
</div>
</body>
</html>
總結
以上所述是小編給大家介紹的Vue入門之a(chǎn)nimate過渡動畫效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關文章
vue百度地圖通過地址名稱獲取地址的經(jīng)緯度gps問題(具體步驟)
在Vue項目中,可以通過使用百度地圖JavaScript?API來實現(xiàn)根據(jù)地址名稱獲取經(jīng)緯度GPS的功能,本文分步驟給大家詳細講解vue百度地圖獲取經(jīng)緯度的實例,感興趣的朋友一起看看吧2023-05-05
使用Vue和ECharts創(chuàng)建交互式圖表的代碼示例
在現(xiàn)代 Web 應用中,數(shù)據(jù)可視化是一個重要的組成部分,它不僅能夠幫助用戶更好地理解復雜的數(shù)據(jù),還能提升用戶體驗,本文給大家使用Vue和ECharts創(chuàng)建交互式圖表的示例,需要的朋友可以參考下2024-11-11

