codecamp

百度智能小程序 折叠面板

collapse 折叠面板

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

属性说明

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

headerType

String

''

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

spread

Boolean

false

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

title

String

''

header 主标题文案

subTitle

String

''

header 否标题文案

list

Array

[]

展开面板内容列表

headerBorder

Boolean

true

是否展示下边框

animationTime

Number

0

折叠面板展开收起动画时长,单位 ms

smt-header-title

String

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

smt-header-sub-title

String

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

smt-content-box

String

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

smt-content-item

String

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

spread

Event

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

示例 

在开发者工具中打开


代码示例

<smt-collapse 
    list="{{item.list}}"
    title="{{item.title}}"
    spread="{{item.spread}}"
    sub-title="{{item.subTitle}}"
    header-type="{{item.headerType}}"
    animation-time="{{item.animationTime}}"
    bind:spread="spread"
    smt-header-title="smt-header-title"
    smt-header-sub-title="smt-header-sub-title"
    smt-content-box="smt-content-box"
    smt-content-item="smt-content-item"
></smt-collapse>
    Page({
       data: {
            item: {
                title: '折叠面板列表',
                subTitle: '展示文本信息',
                headerType: 'horizontal',
                spread: true,
                animationTime: 380,
                list: [
                    {
                        label: '标题一',
                        content: '内容文案'
                    },
                    {
                        label: '标题一',
                        content: '内容文案'
                    },
                    {
                        label: '标题一',
                        content: '内容文案'
                    }
                ]
            }
        },
        spread(e) {
            console.log(e.spread, '展开收起状态');
        } 
    });
    .smt-header-title {
        <!-- 可通过此 class 修改主标题样式 -->
    }
    
    .smt-header-sub-title {
        <!-- 可通过此 class 修改副标题样式 -->
    }
    
    .smt-content-box {
        <!-- 可通过此 class 修改展开面板外层样式 -->
    }
    
    .smt-content-item {
        <!-- 可通过此 class 修改展开面板每一项的样式 -->
    }
    
      {
          "navigationBarTitleText": "折叠面板",
          "usingComponents": {
              "smt-collapse": "@smt-ui/component/src/collapse"
          }
      }


      百度智能小程序 列表项
      百度智能小程序 页面状态
      温馨提示
      下载编程狮App,免费阅读超1000+编程语言教程
      取消
      确定
      目录

      百度智能小程序开发文档

      百度智能小程序 组件

      百度智能小程序 地图

      百度智能小程序 画布

      百度智能小程序 API

      百度智能小程序 界面

      百度智能小程序 关注小程序引导组件

      百度智能小程序 自定义组件

      百度智能小程序 媒体

      百度智能小程序 设备

      百度智能小程序 拨打电话

      百度智能小程序 内存警报

      百度智能小程序 手机联系人

      百度智能小程序 用户截屏事件

      百度智能小程序 第三方平台

      百度智能小程序 开放接口

      百度智能小程序 百度收银支付

      百度智能小程序 分包预下载

      百度智能小程序 数据分析

      百度智能小程序 服务端

      百度智能小程序 云开发

      百度智能小程序 初始化

      百度智能小程序 云函数

      百度智能小程序 服务端初始化

      百度智能小程序 服务器获取上下文

      百度智能小程序 服务端云函数

      百度智能小程序 开发教程

      百度智能小程序 功能开发

      百度智能小程序 基本原理

      百度智能小程序 小程序自动化

      百度智能小程序 视频教程

      关闭

      MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }