- List 列表
- 使用指南
- 一般用法
- 带描述信息
- 包含图片
- 无边框的 Item
- 带 Switch 的 Item
- AtListItem 参数
- AtListItem 参数
List 列表
提供常见的 List 组件,帮助使用者快速搭建列表
使用指南
在 Taro 文件中引入组件
:::demo
import { AtList, AtListItem } from "taro-ui"
:::
一般用法
:::demo
<AtList><AtListItem title='标题文字' onClick={this.handleClick} /><AtListItem title='标题文字' arrow='right' /><AtListItem title='标题文字' extraText='详细信息' /></AtList>
:::
带描述信息
:::demo
<AtList><AtListItem title='标题文字' note='描述信息' /><AtListItem title='标题文字' note='描述信息' arrow='right' /><AtListItemarrow='right'note='描述信息'title='标题文字标题文字标题文字标题文字标题文字'extraText='详细信息详细信息详细信息详细信息'/></AtList>
:::
包含图片
:::demo
<AtList><AtListItemtitle='标题文字'arrow='right'thumb='https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png'/><AtListItemtitle='标题文字'note='描述信息'arrow='right'thumb='http://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png'/><AtListItemtitle='标题文字'note='描述信息'extraText='详细信息'arrow='right'thumb='http://img12.360buyimg.com/jdphoto/s72x72_jfs/t10660/330/203667368/1672/801735d7/59c85643N31e68303.png'/></AtList>
:::
无边框的 Item
:::demo
<AtList hasBorder={false}><AtListItemisSwitchtitle='标题文字'hasBorder={false}onSwitchChange={this.handleChange}/><AtListItemisSwitchtitle='标题文字'hasBorder={false}onSwitchChange={this.handleChange}/></AtList>
:::
带 Switch 的 Item
:::demo
<AtList><AtListItemtitle='标题文字'isSwitchonSwitchChange={this.handleChange}/></AtList>
:::
AtListItem 参数
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| hasBorder | 是否有边框 | Boolean | - | true |
AtListItem 参数
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| title | 元素的标题 | String | - | - |
| note | 元素的描述信息 | String | - | - |
| thumb | 元素的主要缩略图 | String | - | - |
| arrow | 箭头的方向 | String | right,top,bottom |
- |
| extraText | 额外信息的文本 | String | - | - |
| extraThumb | 额外信息的缩略图 | String | - | - |
| isSwitch | 额外信息是否开关 | Boolean | - | false |
| hasBorder | 是否有边框 | Boolean | - | true |
| onClick | 用户点击元素触发的事件 | Function | - | - |
| onSwitchChange | 用户点击切换 Switch 时触发 | Function | - | - |
