@@ -180,6 +180,118 @@ export default defineComponent({
180180
181181:::
182182
183+ ### 自定义Icon位置的代码
184+
185+ icon区域想要自定义样式和事件,可以通过iconContent插槽实现。
186+
187+ ::: demo
188+
189+ ``` vue
190+ <template>
191+ <d-action-timeline :data="timeData" :load-more-config="loadMoreConfig" layout="vertical" :show-tail-line="false">
192+ <template #title="page">
193+ <div>{{ page.option.action }}</div>
194+ </template>
195+ <template #content="page">
196+ <div class="custom-content">{{ page.option.actionContent }}</div>
197+ </template>
198+ <template #iconContent="page">
199+ <d-tooltip position="top" :content="page.option.iconDes">
200+ <div class="custom-icon">{{ page.option.icon }}</div>
201+ </d-tooltip>
202+ </template>
203+ </d-action-timeline>
204+ </template>
205+
206+ <script>
207+ import { defineComponent, reactive, ref } from 'vue';
208+
209+ export default defineComponent({
210+ setup() {
211+ const timeData = [
212+ {
213+ time: '2022-07-01',
214+ actions: [
215+ {
216+ action: '操作信息',
217+ actionContent: '操作内容1',
218+ createdAt: '2022-07-01T07:30:09.681Z',
219+ icon: 'A',
220+ iconDes: '该事件发生在2022-07-01 07:30:09,进行了操作内容1的调整',
221+ },
222+ {
223+ action: '操作信息',
224+ actionContent: '操作内容2',
225+ icon: 'B',
226+ createdAt: '2022/07/01 9:38:00',
227+ iconDes: '该事件发生在2022/07/01 9:38:00,进行了操作内容2的调整',
228+ },
229+ ],
230+ },
231+ {
232+ time: '2022-06-30',
233+ actions: [
234+ {
235+ action: '操作信息',
236+ actionContent: '操作内容3',
237+ createdAt: '2022-06-30 21:39:25',
238+ icon: 'C',
239+ iconDes: '该事件发生在2022-06-30 21:39:25,进行了操作内容3的调整',
240+ },
241+ {
242+ action: '操作信息',
243+ actionContent: '操作内容4',
244+ createdAt: 'Fri Jun 30 2022 15:21:54 GMT+0800(中国标准时间)',
245+ icon: 'D',
246+ iconDes: '该事件发生在Fri Jun 30 2022 15:21:54,进行了操作内容4的调整',
247+ },
248+ {
249+ action: '操作信息',
250+ actionContent: '操作内容5',
251+ createdAt: 'Fri Jun 30 2022 15:21:54 GMT+0800(中国标准时间)',
252+ iconDes: '该事件发生在Fri Jun 30 2022 15:21:54,进行了操作内容5的调整',
253+ icon: 'E',
254+ },
255+ ],
256+ },
257+ ];
258+ const loadMoreConfig = {
259+ type: 'button',
260+ };
261+ return {
262+ timeData,
263+ loadMoreConfig,
264+ };
265+ },
266+ });
267+ </script>
268+
269+ <style scoped>
270+ .custom-content {
271+ background: #fff;
272+ box-shadow: var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-feedback-overlay-shadow, rgba(37, 43, 58, 0.16));
273+ border-radius: 4px;
274+ margin-left: 32px;
275+ margin-top: 12px;
276+ padding: 12px 20px;
277+ }
278+ .custom-icon {
279+ width: 24px;
280+ height: 24px;
281+ background: #abcdef;
282+ border-radius: 50%;
283+ line-height: 24px;
284+ text-align: center;
285+ color: #FFFFFF;
286+ position: relative;
287+ margin-right: 8px;
288+ z-index: 3;
289+ }
290+ </style>
291+ ```
292+
293+ :::
294+
183295### ActionTimeline 参数
184296
185297| 参数名 | 类型 | 默认值 | 说明 |
@@ -203,6 +315,7 @@ export default defineComponent({
203315| :------ | :----------------------- | :------------------------------------------- |
204316| content | ` { option: ActionItem } ` | 必选,内容区域插槽 |
205317| title | ` { option: ActionItem } ` | 标题区域插槽,横向布局时可选,纵向布局时必选 |
318+ | iconContent | ` { option: ActionItem } ` | 可选,图标区域插槽 |
206319
207320### 接口定义
208321
0 commit comments