dengjunjie
2025-03-12 f43b7df8400f4fcffc9f19dca0888d61e2b33d5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
  <view class="tn-time-line-item-class tn-time-line-item">
    <view>
      <slot name="content"></slot>
    </view>
    <view class="tn-time-line-item__node" :style="[nodeStyle]">
      <slot name="node">
        <view class="tn-time-line-item__node--dot"></view>
      </slot>
    </view>
  </view>
</template>
 
<script>
  export default {
    name: 'tn-time-line-item',
    props: {
      // 节点左边图标的绝对定位top值
      top: {
        type: [String, Number],
        default: ''
      }
    },
    computed: {
      nodeStyle() {
        let style = {}
        if (this.top !== '') style.top = this.top + 'rpx'
        
        return style
      }
    },
    data() {
      return {
        
      }
    }
  }
</script>
 
<style lang="scss" scoped>
  
  .tn-time-line-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    margin-bottom: 32rpx;
    
    &__node {
      display: flex;
      flex-direction: row;
      position: absolute;
      top: 12rpx;
      left: -40rpx;
      align-items: center;
      justify-content: center;
      font-size: 24rpx;
      transform-origin: 0;
      transform: translateX(-50%);
      z-index: 1;
      background-color: transparent;
      
      &--dot {
        width: 16rpx;
        height: 16rpx;
        border-radius: 100rpx;
        background-color: #AAAAAA;
      }
    }
  }
</style>