CSS点击切换或隐藏盒子的卷起、展开效果(css鼠标点击切换样式) 第1张

<template>
  <p class="8f34-678b-0528-a6c2 main">
    <el-button @click="onCllick">切换</el-button>
    <transition name="slideDown">
      <p class="678b-0528-a6c2-8e66 info" v-if="isShow">1111</p>
    </transition>
  </p>
</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点击切换或隐藏盒子的卷起、展开效果的文章就介绍到这了,更多相关css内容请搜索酷瑞百科以前的文章或继续浏览下面的相关文章,希望大家以后多多支持酷瑞百科

收藏(0)