tn-time-line-item.vue 1.4 KB

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