# 6.1 滑动单元格(Swipe Cell)
可侧滑的单元格组件
# 基础用法
<template>
<dof-swipe-cell :buttons-text="buttons">
<text slot="slideSlot">列表项内容</text>
</dof-swipe-cell>
</template>
<script>
export default {
data() {
return {
buttons: [
{ value: '删除', background_color: '#F56428', color: '#ffffff' }
]
}
}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Attributes
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
slide-direction | Number | N | 1 | 侧滑方向(LTR):1 左滑显示右侧按钮,2 右滑显示左侧按钮;RTL 时镜像 |
buttons-text | Array | N | [{"value":"删除","background_color":"#F56428","color":"#ffffff"}] | 侧滑按钮配置,见注 1 |
back-accept | Number | N | 0 | 设为 1 时,已展开的按钮会在该值变化后收起 |
need-dark-mode | Boolean | N | false | 是否启用 M-dark/T-dark 内置暗黑适配 |
background-color | String | N | '' | 背景色 |
action-background-color | String | N | '' | 操作区域背景色 |
text-color | String | N | '' | 文字颜色 |
isRTL | Boolean | N | false | 是否启用 RTL(从右到左)布局;默认关闭 ^2.5.10 |
RTL 下侧滑方向与操作按钮显示侧镜像:slide-direction=1 为右滑显示左侧按钮,2 为左滑显示右侧按钮;按钮配置无需反转。
设置 :need-dark-mode="true" 可启用内置暗黑配色,主题初始化与构建配置见 接入说明。
颜色属性为空时使用内置配色;业务显式颜色和样式覆盖优先于默认配色,关闭暗黑适配后仍有效。
单个操作按钮的业务颜色优先,删除等状态色保留。
- 注 1:
buttons-text的每项配置如下:
| 字段 | Type | Required | Description |
|---|---|---|---|
value | String | Y | 按钮文本 |
background_color | String | Y | 按钮背景色 |
color | String | Y | 按钮文本颜色 |
# Slots
| 插槽名 | 说明 |
|---|---|
slideSlot | 单元格主内容 |
当前组件点击侧滑按钮时仅展示按钮文本,不对外派发事件。