From 3cdd771e48e1e4ecae7bb8641d4871a2a1a96d66 Mon Sep 17 00:00:00 2001 From: VRlie <2755561608@qq.com> Date: Mon, 3 Jun 2024 20:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=20ActionTimeline=E7=BB=84=E4=BB=B6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89icon=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=E6=8F=92=E6=A7=BD=E3=80=82=20#1846?= =?UTF-8?q?=20(#1872)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(ActionTimeline): ActionTimeline组件新增自定义icon位置的内容插槽,未传入时默认使用原方式,对现有使用不影响。#1846 * feat(ActionTimeline): 删除多余的console #1846 --- .../action-timeline/src/action-timeline.tsx | 8 +- .../docs/components/action-timeline/index.md | 113 ++++++++++++++++++ 2 files changed, 117 insertions(+), 4 deletions(-) diff --git a/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx b/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx index 1b00f9d192..c5adaf3918 100644 --- a/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx +++ b/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx @@ -48,10 +48,10 @@ export default defineComponent({
-
+ {ctx.slots.iconContent?.({ option: item }) ||
{!item.icon &&
} -
+
}
{ctx.slots.title?.({ option: item })}
{item.createdAt}
@@ -62,10 +62,10 @@ export default defineComponent({ const renderHorizontalBody = (actionData: ActionData, parentIndex: number) => actionData.actions?.map((item, index) => (
-
+ {ctx.slots.iconContent?.({ option: item }) ||
{!item.icon &&
} -
+
}
{ctx.slots.content?.({ option: item })}
{item.createdAt}
{!(actionData.actions && data?.value && index === actionData.actions.length - 1 && parentIndex === data?.value?.length - 1) && ( diff --git a/packages/devui-vue/docs/components/action-timeline/index.md b/packages/devui-vue/docs/components/action-timeline/index.md index 72610019f7..cc344a2452 100644 --- a/packages/devui-vue/docs/components/action-timeline/index.md +++ b/packages/devui-vue/docs/components/action-timeline/index.md @@ -180,6 +180,118 @@ export default defineComponent({ ::: +### 自定义Icon位置的代码 + +icon区域想要自定义样式和事件,可以通过iconContent插槽实现。 + +:::demo + +```vue + + + + + +``` + +::: + ### ActionTimeline 参数 | 参数名 | 类型 | 默认值 | 说明 | @@ -203,6 +315,7 @@ export default defineComponent({ | :------ | :----------------------- | :------------------------------------------- | | content | `{ option: ActionItem }` | 必选,内容区域插槽 | | title | `{ option: ActionItem }` | 标题区域插槽,横向布局时可选,纵向布局时必选 | +| iconContent | `{ option: ActionItem }` | 可选,图标区域插槽 | ### 接口定义