<template>
<view class="u-time-axis-item">
<slot name="content" />
<view class="u-time-axis-node" :style="[nodeStyle]">
<slot name="node">
<view class="u-dot"></view>
</slot>
</view>
</view>
</template>
<script>
export default {
name: 'u-time-line-item',
props: {
bgColor: {
type: String,
default: '#ffffff'
},
nodeTop: {
type: [String, Number],
default: ''
}
},
data() {
return {}
},
computed: {
nodeStyle() {
let style = {
backgroundColor: this.bgColor
}
if (this.nodeTop != '') style.top = this.nodeTop + 'rpx'
return style
}
}
}
</script>
<style lang="scss" scoped>
@import '../../libs/css/style.components.scss';
.u-time-axis-item {
display: flex;
flex-direction: column;
width: 100%;
position: relative;
margin-bottom: 16rpx;
}
.u-time-axis-node {
position: absolute;
top: 6rpx;
left: -40rpx;
transform-origin: 0;
transform: translateX(-50%);
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
font-size: 12rpx;
}
.u-dot {
height: 8rpx;
width: 8rpx;
border-radius: 50rpx;
background: #ddd;
}
</style>