您好,登錄后才能下訂單哦!
關于appear的用法和enter的用法相似,它只是在第一次渲染的時候才會起作用。看完整的代碼:
別忘了引用vue.js
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>初始渲染的過渡</title> <script src="vue.js"></script> </head> <style> .custom-appear-active{ color: #2fe26d; background: #b6b6b6; transition: all 1s ease; } .custom-appear{ font-size: 40px; color: #e069e2; background: #7798e2; } .custom-appear-to{ color: #e29138; background: #1c8942; } </style> <body> <div id="app"> <transition appear appear-class="custom-appear" appear-to-class="custom-appear-to" appear-active-class="custom-appear-active" > <p>appear</p> </transition> </div> <script> new Vue({ el: "#app" }) </script> </body> </html>
但是這里有一些問題:關于appear-class、 appear-to-class、 appear-active-class的相同屬性那個起作用的問題。
四種情況:(與他們在style中的排列順序有關系)
1、appear-class、 appear-to-class、 appear-active-class或者 appear-to-class、appear-class、 appear-active-class的排列順序,此時只有appear-active-class的屬性起作用。
2、appear-active-class、appear-class、 appear-to-class
此時appear-active-class的不起作用,由appear-class過渡到appear-to-class屬性。
3、appear-class、appear-active-class、 appear-to-class
此時appear-class屬性不起作用,由appear-active-class過渡到 appear-to-class屬性。
4、 appear-to-class、 appear-active-class、appear-class
此時appear-to-class不起作用,由appear-class過渡到 appear-active-class屬性。
enter也有相似的問題
總結
以上所述是小編給大家介紹的vue中appear的用法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對億速云網站的支持!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。