美文网首页
纯VUE实现折叠面板

纯VUE实现折叠面板

作者: tenro | 来源:发表于2020-05-08 11:54 被阅读0次
<template>
  <div>
    <div class="item">
        <button @click="boxshow = !boxshow">点击展开/关闭</button>
        <!--这里的name 和 css 类名第一个字段要一样-->
        <transition name="draw">   
            <div class="box"  v-show="boxshow"></div>
        </transition>
    </div>
  </div>
</template>

<script>
export default {
    components: {},
    data() {
        return {
             boxshow:false
        }
    }
}
</script>

<style>
.box{
    height:200px;width: 200px;
    background-color:black;
}
.draw-enter-active, .draw-leave-active {
    transition: all 1s ease;
}
.draw-enter, .draw-leave-to {
    height: 0;
}
</style>

相关文章

网友评论

      本文标题:纯VUE实现折叠面板

      本文链接:https://www.haomeiwen.com/subject/vitfnhtx.html