From ebf0cd86385e9b1162b6bd3c14b8dd665436f371 Mon Sep 17 00:00:00 2001 From: aolinpk <2755561608@qq.com> Date: Fri, 31 May 2024 17:29:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(ActionTimeline):=20ActionTimeline?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?icon=E4=BD=8D=E7=BD=AE=E7=9A=84=E5=86=85=E5=AE=B9=E6=8F=92?= =?UTF-8?q?=E6=A7=BD=EF=BC=8C=E6=9C=AA=E4=BC=A0=E5=85=A5=E6=97=B6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=BD=BF=E7=94=A8=E5=8E=9F=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E7=8E=B0=E6=9C=89=E4=BD=BF=E7=94=A8=E4=B8=8D=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=E3=80=82#1846?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action-timeline/src/action-timeline.tsx | 9 +- .../docs/components/action-timeline/index.md | 113 ++++++++++++++++++ 2 files changed, 118 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..e013c8510a 100644 --- a/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx +++ b/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx @@ -9,6 +9,7 @@ export default defineComponent({ props: actionTimelineProps, emits: ['actionLoadMore'], setup(props: ActionTimelineProps, ctx: SetupContext) { + console.log(ctx.slots.content) const { layout, data, showTailLine, showStatusBgColor, showStatusLineColor, loadMoreConfig } = toRefs(props); const isVertical = computed(() => layout.value === 'vertical'); const containerClass = computed(() => ({ @@ -48,10 +49,10 @@ export default defineComponent({
-
+ {ctx.slots.iconContent?.({ option: item }) ||
{!item.icon &&
} -
+
}
{ctx.slots.title?.({ option: item })}
{item.createdAt}
@@ -62,10 +63,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 }` | 可选,图标区域插槽 | ### 接口定义 From d919502b636ee1da178bb0ee83de4dd534244b1f Mon Sep 17 00:00:00 2001 From: aolinpk <2755561608@qq.com> Date: Fri, 31 May 2024 17:32:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(ActionTimeline):=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E7=9A=84console=20#1846?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/devui-vue/devui/action-timeline/src/action-timeline.tsx | 1 - 1 file changed, 1 deletion(-) 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 e013c8510a..c5adaf3918 100644 --- a/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx +++ b/packages/devui-vue/devui/action-timeline/src/action-timeline.tsx @@ -9,7 +9,6 @@ export default defineComponent({ props: actionTimelineProps, emits: ['actionLoadMore'], setup(props: ActionTimelineProps, ctx: SetupContext) { - console.log(ctx.slots.content) const { layout, data, showTailLine, showStatusBgColor, showStatusLineColor, loadMoreConfig } = toRefs(props); const isVertical = computed(() => layout.value === 'vertical'); const containerClass = computed(() => ({