• uniapp 内容展开组件


    uni-collapse折叠面板并不符合需求,需要自己写一个。

    效果展示:

    代码: (vue3版本)

    1. <script setup>
    2. import {ref,reactive} from 'vue'
    3. let isCollapse =ref(true) //是否展开控件
    4. // 计算组件内容区域的高度
    5. const calcHeight = () =>{
    6. //默认高度
    7. let h = "70rpx";
    8. if (!isCollapse.value) {
    9. //展开后高度
    10. h = 190 + "rpx";
    11. }
    12. return h;
    13. }
    14. //切换展开与否
    15. const changeMode =()=>{
    16. isCollapse.value =!isCollapse.value
    17. }
    18. script>
    19. <style lang="scss" scoped>
    20. .collapse-view {
    21. width: 100%;
    22. height: auto;
    23. background-color: #fff;
    24. margin-top: 20rpx;
    25. swiper {
    26. width: 100%;
    27. height: 60upx;
    28. }
    29. .collapse-content {
    30. padding-bottom: 26rpx;
    31. border-bottom: 1upx solid #f7f7f7;
    32. border-bottom-left-radius: 37upx;
    33. border-bottom-right-radius: 37upx;
    34. }
    35. .collapse-swiper {
    36. min-height: 70upx;
    37. transition: height ease-out 0.3s;
    38. }
    39. .mode-change {
    40. display: flex;
    41. justify-content: center;
    42. margin-top: 10upx;
    43. margin-bottom: 22upx;
    44. :deep(.uni-icons) {
    45. position: absolute;
    46. }
    47. }
    48. }
    49. style>

    vue2版本的 逻辑片段

  • 相关阅读:
    通过制作4个游戏学习Python
    文本对比学习综述
    操作系统(九)进程通信
    向日葵管理平台添加主机,获取葵码,在设备上进行绑定
    奇思妙想构造题 ARC145 D - Non Arithmetic Progression Set
    【Autosar RTM】
    Docker基础-cgroup
    做机器人开发,你一定绕不开的模块!
    java网络游戏后台管理系统计算机毕业设计MyBatis+系统+LW文档+源码+调试部署
    Python期末复习题:组合数据类型
  • 原文地址:https://blog.csdn.net/w1311004532/article/details/133160877