折叠面板小功能

今天项目让弄一个折叠面板

UI库里的不太适用
然后就自己弄了一个
直接上代码
<template>
  <div>
    <!-- 按钮里面的文字没做动态控制 -->
    <button @click="isOpenFold(foldClass)">点我展开或收起</button>
    <div class="progress-bar" :class="foldClass">
        这里是展开显示的东西
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      foldClass: "fold-close",
    };
  },
  methods: {
    isOpenFold(calssName) {
      this.foldClass = className = "fold-open" ? "fold-close" : "fold-open";
    },
  },
};
</script>

<style lang="scss">
.fold-open {
  transition: max-height 0.5s cubic-bezier(1, 0, 1, 0);
  max-height: 999px;
}
.fold-close {
  transition: max-height 0.5s cubic-bezier(0, 1, 0, 1);
  max-height: 0;
}
.progress-bar {
  overflow: hidden;
}
</style>


以上就是折叠面板的一个小功能
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值