Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:swipeCell文档 #510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ export default {
onChange: Function as PropType<TdSwipeCellProps['onChange']>,
/** 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件) */
onClick: Function as PropType<TdSwipeCellProps['onClick']>,
/** 滑动技术事件 */
onDragEnd: Function as PropType<TdSwipeCellProps['onDragEnd']>,
/** 滑动开始事件 */
onDragStart: Function as PropType<TdSwipeCellProps['onDragStart']>,
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ opened | Boolean / Array | false | Typescript:`boolean \| Array<boolean>` | N
right | Array / Slot / Function | - | Typescript:`Array<SwipeActionItem> \| TNode` `interface SwipeActionItem {text: string; className?: string; style?: string; sure?: string \| TNode; onClick?: () => void; [key: string]: any }`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts) | N
onChange | Function | | Typescript:`(value: string) => void`<br/> | N
onClick | Function | | Typescript:`(action: SwipeActionItem, source: SwipeSource) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/> | N
onDragEnd | Function | | Typescript:`() => void`<br/>swipe end event | N
onDragStart | Function | | Typescript:`() => void`<br/>swipe start event | N

### SwipeCell Events

name | params | description
-- | -- | --
change | `(value: string)` | \-
click | `(action: SwipeActionItem, source: SwipeSource)` | [see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/>
drag-end | \- | swipe end event
drag-start | \- | swipe start event

### SwipeCellInstanceFunctions 组件实例方法

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ opened | Boolean / Array | false | 操作项是否呈现为打开态,值为数
right | Array / Slot / Function | - | 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', style: 'background-color: red', onClick: () => {} }]`。TS 类型:`Array<SwipeActionItem> \| TNode` `interface SwipeActionItem {text: string; className?: string; style?: string; sure?: string \| TNode; onClick?: () => void; [key: string]: any }`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts) | N
onChange | Function | | TS 类型:`(value: string) => void`<br/>菜单展开或者收回后将菜单的状态传递给父组件,值为数组时表示分别控制左右滑动的展开和收起状态 | N
onClick | Function | | TS 类型:`(action: SwipeActionItem, source: SwipeSource) => void`<br/>操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/> | N
onDragEnd | Function | | TS 类型:`() => void`<br/>滑动技术事件 | N
onDragStart | Function | | TS 类型:`() => void`<br/>滑动开始事件 | N

### SwipeCell Events

名称 | 参数 | 描述
-- | -- | --
change | `(value: string)` | 菜单展开或者收回后将菜单的状态传递给父组件,值为数组时表示分别控制左右滑动的展开和收起状态
click | `(action: SwipeActionItem, source: SwipeSource)` | 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/>
drag-end | \- | 滑动技术事件
drag-start | \- | 滑动开始事件

### SwipeCellInstanceFunctions 组件实例方法

Expand Down
8 changes: 8 additions & 0 deletions packages/products/tdesign-mobile-vue/src/swipe-cell/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export interface TdSwipeCellProps {
* 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)
*/
onClick?: (action: SwipeActionItem, source: SwipeSource) => void;
/**
* 滑动技术事件
*/
onDragEnd?: () => void;
/**
* 滑动开始事件
*/
onDragStart?: () => void;
}

/** 组件实例方法 */
Expand Down
66 changes: 66 additions & 0 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -108250,6 +108250,72 @@
],
"field_type_text": []
},
{
"id": 1735870377,
"platform_framework": [
"8"
],
"component": "SwipeCell",
"field_category": 2,
"field_name": "dragEnd",
"field_type": [],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "滑动技术事件",
"field_desc_en": "swipe end event",
"field_required": 0,
"event_input": "",
"create_time": "2025-01-03 02:12:57",
"update_time": "2025-01-03 02:12:57",
"event_output": null,
"custom_field_type": null,
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Events",
"platform_framework_text": [
"Vue(Mobile)"
],
"field_type_text": []
},
{
"id": 1735870362,
"platform_framework": [
"8"
],
"component": "SwipeCell",
"field_category": 2,
"field_name": "dragStart",
"field_type": [],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "滑动开始事件",
"field_desc_en": "swipe start event",
"field_required": 0,
"event_input": "",
"create_time": "2025-01-03 02:12:42",
"update_time": "2025-01-03 02:12:42",
"event_output": null,
"custom_field_type": null,
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Events",
"platform_framework_text": [
"Vue(Mobile)"
],
"field_type_text": []
},
{
"id": 1719280157,
"platform_framework": [
Expand Down