You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
2.2 KiB

4 years ago
  1. <template>
  2. <view class="mix-timeline">
  3. <view class="cell" v-for="(item, index) in list" :key="index">
  4. <view class="left column center">
  5. <text class="time">{{ item.time | date('H:i') }}</text>
  6. <text class="date">{{ item.time | date('m/d') }}</text>
  7. </view>
  8. <view class="cen center">
  9. <view class="circle center"></view>
  10. </view>
  11. <view class="right column">
  12. <text class="title">{{ item.title }}</text>
  13. <text v-if="item.tip" class="tip">{{ item.tip }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. /**
  20. * 时间轴
  21. * {
  22. * title: 标题
  23. * tip: 小字
  24. * time: 时间戳
  25. * }
  26. */
  27. export default {
  28. data() {
  29. return {
  30. };
  31. },
  32. props: {
  33. list: {
  34. type: Array,
  35. default(){
  36. return []
  37. }
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped lang="scss">
  43. .mix-timeline{
  44. }
  45. .cell{
  46. display: flex;
  47. align-items: flex-start;
  48. width: 100%;
  49. padding: 0 30rpx 0;
  50. &:first-child .circle{
  51. &:before{
  52. background-color: $base-color;
  53. }
  54. &:after{
  55. content: '';
  56. position: absolute;
  57. width: 28rpx;
  58. height: 28rpx;
  59. background-color: #f9e0eb;
  60. border-radius: 100rpx;
  61. }
  62. }
  63. &:last-child .right:before{
  64. display: none;
  65. }
  66. }
  67. .left{
  68. .time{
  69. font-size: 26rpx;
  70. color: #333;
  71. line-height: 44rpx;
  72. }
  73. .date{
  74. font-size: 20rpx;
  75. color: #333;
  76. }
  77. }
  78. .cen{
  79. width: 80rpx;
  80. height: 44rpx;
  81. .circle{
  82. width: 16rpx;
  83. height: 16rpx;
  84. position: relative;
  85. z-index: 1;
  86. &:before{
  87. content: '';
  88. width: 16rpx;
  89. height: 16rpx;
  90. background-color: #ddd;
  91. border-radius: 100rpx;
  92. position: relative;
  93. z-index: 5;
  94. }
  95. }
  96. }
  97. .right{
  98. flex: 1;
  99. padding-bottom: 30rpx;
  100. position: relative;
  101. min-height: 96rpx;
  102. &:before{
  103. content: '';
  104. width: 2rpx;
  105. position: absolute;
  106. left: 0;
  107. top: 0;
  108. bottom: 0;
  109. background-color: #ddd;
  110. transform: translate(-42rpx, 22rpx);
  111. }
  112. .title{
  113. font-size: 28rpx;
  114. color: #333;
  115. line-height: 44rpx;
  116. font-weight: 700;
  117. }
  118. .tip{
  119. margin-top: 6rpx;
  120. font-size: 24rpx;
  121. color: #999;
  122. line-height: 36rpx;
  123. }
  124. }
  125. </style>