You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.9 KiB

title description spline isComponent
Indexes 索引 用于页面中信息快速检索,可以根据目录中的页码快速找到所需的内容。 navigation true

IndexesAnchor 索引锚点组件于 0.32.0 版本上线,请留意版本。

引入

全局引入,在 miniprogram 根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

"usingComponents": {
  "t-indexes": "tdesign-miniprogram/indexes/indexes",
  "t-indexes-anchor": "tdesign-miniprogram/indexes-anchor/indexes-anchor"
}

代码演示

基础索引

{{ base }}

自定义索引

{{ custom }}

API

Indexes Props

名称 类型 默认值 说明 必传
index-list Array - 0.32.0。索引字符列表。不传默认 A-Z。TS 类型:string [] | number[] N
list Array [] 已废弃。索引列表的列表数据。每个元素包含三个子元素index(string)索引值例如123...或ABC等title(string): 索引标题可不填将默认设为索引值children(Array<{title: string}>): 子元素列表title为子元素的展示文案。。TS 类型:ListItem[] interface ListItem { title: string; index: string; children: { title: string; [key: string]: any} [] }详细类型定义 N
sticky Boolean true 索引是否吸顶默认为true。TS 类型:Boolean N
sticky-offset Number 0 1.0.0。锚点吸顶时与顶部的距离 N

Indexes Events

名称 参数 描述
change (index: string | number) 0.34.0。索引发生变更时触发事件
select (index: string | number) 点击侧边栏时触发事件

IndexesAnchor Props

名称 类型 默认值 说明 必传
external-classes Array - 组件类名,用于设置组件外层元素类名。['t-class'] N
index String / Number - 索引字符 N