2022-09-06 12:03:37 +00:00
|
|
|
<template>
|
2023-06-09 08:24:27 +00:00
|
|
|
<div :class="cx('root')" v-bind="ptm('root')" data-pc-name="timeline">
|
2023-06-01 12:14:49 +00:00
|
|
|
<div v-for="(item, index) of value" :key="getKey(item, index)" :class="cx('event')" v-bind="ptm('event')">
|
|
|
|
<div :class="cx('opposite')" v-bind="ptm('opposite')">
|
2022-09-06 12:03:37 +00:00
|
|
|
<slot name="opposite" :item="item" :index="index"></slot>
|
|
|
|
</div>
|
2023-06-01 12:14:49 +00:00
|
|
|
<div :class="cx('separator')" v-bind="ptm('separator')">
|
2022-09-06 12:03:37 +00:00
|
|
|
<slot name="marker" :item="item" :index="index">
|
2023-06-01 12:14:49 +00:00
|
|
|
<div :class="cx('marker')" v-bind="ptm('marker')"></div>
|
2022-09-06 12:03:37 +00:00
|
|
|
</slot>
|
2022-09-14 11:26:01 +00:00
|
|
|
<slot v-if="index !== value.length - 1" name="connector" :item="item" :index="index">
|
2023-06-01 12:14:49 +00:00
|
|
|
<div :class="cx('connector')" v-bind="ptm('connector')"></div>
|
2022-09-06 12:03:37 +00:00
|
|
|
</slot>
|
|
|
|
</div>
|
2023-06-01 12:14:49 +00:00
|
|
|
<div :class="cx('content')" v-bind="ptm('content')">
|
2022-09-06 12:03:37 +00:00
|
|
|
<slot name="content" :item="item" :index="index"></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-09-14 11:26:01 +00:00
|
|
|
import { ObjectUtils } from 'primevue/utils';
|
2023-06-13 13:24:14 +00:00
|
|
|
import BaseTimeline from './BaseTimeline.vue';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Timeline',
|
2023-06-13 13:24:14 +00:00
|
|
|
extends: BaseTimeline,
|
2022-09-06 12:03:37 +00:00
|
|
|
methods: {
|
|
|
|
getKey(item, index) {
|
|
|
|
return this.dataKey ? ObjectUtils.resolveFieldData(item, this.dataKey) : index;
|
|
|
|
}
|
|
|
|
}
|
2022-09-14 11:26:01 +00:00
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
</script>
|