欢迎光临
我们一直在努力

九八云百度小程序教程:collapse 折叠面板

  • collapse 折叠面板
    • 属性说明
    • 示例
      • 代码示例 1:默认
      • 代码示例 2:使用 slot

    collapse 折叠面板

    解释:折叠面板,支持配置主标题文案和副标题文案,并可点击展开折叠面板查看更多内容。适用于信息展示,并可放置在页面的任何位置。

    属性说明

    属性名 类型 必填 默认值 说明

    headerType

    String

    vertical

    折叠面板 header 布局类型,horizontal 水平布局、vertical 上下布局

    spread

    Boolean

    false

    展开收起状态,展开为 true,收起为 false

    onlySpreadByIcon

    Boolean

    false

    展开收起事件,是否仅绑定在icon上(是:true,否:false)

    title

    String

    header 主标题文案

    subTitle

    String

    ‘’

    header 否标题文案

    list

    Array

    展开面板内容列表

    headerBorder

    Boolean

    true

    是否展示下边框

    animationTime

    Number

    0

    折叠面板展开收起动画时长(单位:ms)

    spreadHeight

    String

    1rpx

    收起时内容区的高度(单位:rpx)

    smt-collapse-header

    String

    提供扩展样式类,供开发者自定义组件样式。可通过此 class 修改header外层样式

    smt-header-title

    String

    提供扩展样式类,供开发者自定义组件样式。可通过此 class 修改主标题样式

    smt-header-sub-title

    String

    提供扩展样式类,供开发者自定义组件样式。可通过此 class 修改副标题样式

    smt-content-box

    String

    提供扩展样式类,供开发者自定义组件样式。可通过此 class 修改展开面板外层样式

    smt-content-item

    String

    提供扩展样式类,供开发者自定义组件样式。可通过此 class 修改展开面板每一项的样式

    spread

    EventHandle

    展开收起触发事件,e.spread展开收起状态

    示例

    跳转编辑工具

    在开发者工具中打开

    在 WEB IDE 中打开

    扫码体验

    代码示例

    请使用百度APP扫码

    代码示例 1:默认

    • SWAN
    • JS
    • CSS
    • JSON
    
     
    1. <smt-collapse
    2. list="{{item.list}}"
    3. title="{{item.title}}"
    4. spread="{{item.spread}}"
    5. sub-title="{{item.subTitle}}"
    6. header-type="{{item.headerType}}"
    7. animation-time="{{item.animationTime}}"
    8. bind:spread="spread"
    9. smt-header-title="smt-header-title"
    10. smt-header-sub-title="smt-header-sub-title"
    11. smt-content-box="smt-content-box"
    12. smt-content-item="smt-content-item"
    13. ></smt-collapse>

    代码示例 2:使用 slot

    • SWAN
    • JS
    • CSS
    • JSON
    
     
    1. <smt-collapse
    2. spread="{{slot.spread}}"
    3. spread-height="{{slot.spreadHeight}}"
    4. header-type="{{slot.headerType}}"
    5. animation-time="{{slot.animationTime}}"
    6. bind:spread="spread"
    7. >
    8. <view slot="header">插槽内容</view>
    9. <view slot="content" class="check-box">
    10. <view class="check-box-item" s-for="{{slot.checkBoxlist}}">{{item.label}}</view>
    11. </view>
    12. </smt-collapse>

    赞(0) 打赏
    未经允许不得转载:九八云安全 » 九八云百度小程序教程:collapse 折叠面板

    评论 抢沙发