• 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版本的 逻辑片段

  • 相关阅读:
    R语言使用dplyr包的arrange函数进行dataframe排序、arrange函数基于一个字段(变量)进行升序排序实战(默认升序)
    VUE+Layui 输入框、下拉选择框、复选框、开关、文本域 数据回显
    如何运营外贸独立站
    Python generator高级方法应用解析
    【深入了解Java String类】
    JuiceFS v1.0 beta2 发布|进一步提升稳定性
    sql语句 如果为空值显示为0
    Unity之NetCode多人网络游戏联机对战教程(6)--NetworkTransform组件
    我的影刀故事
    论文解读(AutoSSL)《Automated Self-Supervised Learning for Graphs》
  • 原文地址:https://blog.csdn.net/w1311004532/article/details/133160877