CSS点击切换或隐藏盒子的卷起、展开效果

ID:16022 / 打印

<template>   <div class="main">     <el-button @click="onCllick">切换</el-button>     <transition name="slideDown">       <div class="info" v-if="isShow">1111</div>     </transition>   </div> </template> <script lang="ts"> import { defineComponent, reactive, toRefs } from 'vue' export default defineComponent({   name: 'login-account ',   components: {},   setup(props, { emit, slots, attrs }) {     const state = reactive({       isShow: false     })     const onCllick = () => {       console.log('切换')       state.isShow = !state.isShow     }     return {       ...toRefs(state),       onCllick     }   } }) </script> <style lang="less"> .info {   width: 100px;   height: 400px;   background-color: skyblue;   margin: 0 auto; } .slideDown-enter-active, .slideDown-leave-active {   transition: all 0.5s ease-in-out; } .slideDown-enter-from {   height: 0; } .slideDown-leave-to {   height: 0; } </style>
上一篇: 关于css中的 background-attachment 属性详解
下一篇: flex和传统方式实现左右两栏式

作者:admin @ 24资源网   2024-10-30

本站所有软件、源码、文章均有网友提供,如有侵权联系308410122@qq.com

与本文相关文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。