vue使用transition組件動畫效果的實例代碼
transition文檔地址定義一個背景彈出層實現淡入淡出效果
<template> <div> <button @click='show = !show'> Toggle </button> <transition name='fadeBg'> <div 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組件動畫內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!
相關文章: