transition文檔地址
定義一個背景彈出層實現淡入淡出效果
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<template> <div> <button @click= "show = !show" > Toggle </button> <div class= "bg" v- if = "show" >hello</div> </transition> </div> </template> <script> export default { data: () => ({ show: true }), }; </script> <style lang= "less" scoped> .fadeBg-enter-active, .fadeBg-leave-active { transition: opacity 0.3s ease; } .fadeBg-enter, .fadeBg-leave-to { opacity: 0; } .bg { position: fixed; top: 20px; left: 0; z-index: 105; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); } </style> |
到此這篇關于vue使用transition組件動畫效果的實例代碼的文章就介紹到這了,更多相關vue transition組件動畫內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!
原文鏈接:https://blog.csdn.net/AK852369/article/details/112848530