You can not 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.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

title description spline isComponent
SwipeCell 滑动操作 用于承载列表中的更多操作,通过左右滑动来展示,按钮的宽度固定高度根据列表高度而变化。 message true

引入

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

"usingComponents": {
   "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell"
}

组件类型

左滑单操作

{{ left }}

右滑单操作

{{ right }}

左右滑操作

{{ double }}

带图标的滑动操作

{{ icon }}

API

SwipeCell Props

名称 类型 默认值 说明 必传
disabled Boolean - 是否禁用滑动 N
opened Boolean / Array false 操作项是否呈现为打开态值为数组时表示分别控制左右滑动的展开和收起状态。TS 类型:boolean | Array<boolean> N
left Array / Slot - 左侧滑动操作项。所有行为同 right。TS 类型:Array<SwipeActionItem> N
right Array / Slot - 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。right.text 表示操作文本,right.className 表示操作项类名,right.style 表示操作项样式,right.onClick 表示点击操作项后执行的回调函数。示例:[{ text: '删除', icon: 'delete', style: 'background-color: red', onClick: () => {} }]。TS 类型:Array<SwipeActionItem> interface SwipeActionItem {text?: string; icon?: string | object, className?: string; style?: string; onClick?: () => void; [key: string]: any }详细类型定义 N

SwipeCell Events

名称 参数 描述
click (action: SwipeActionItem, source: SwipeSource) 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。详细类型定义
type SwipeSource = 'left' | 'right'