使用max-height实现展开收回的探讨

33 阅读1分钟

只写了核心代码

 <div
  class="collapse"
  :class="{ 'collapse-unfold': 判断条件,true为展开 }"
>
</div>
.collapse {
max-height: 42px;
transition: all 0.8s cubic-bezier(0, 1, 0, 1);
overflow: hidden;
}
.collapse.collapse-unfold {
max-height: 120vh;
transition: all 0.8s ease-in-out;
}