查看: 34|回复: 0

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

[复制链接]

0

主题

0

回帖

0

积分

积极分子

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2011-5-11
发表于 昨天 22:16 | 显示全部楼层 |阅读模式

<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>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部