z-timeline-item.vue 1007 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view>
  3. <view class="z-time-item flex-n ml-10" :class="align=='center'?'fac':''">
  4. <view class="dot" :style="{background:bgColor,border: '5rpx solid '+borderColor}"></view>
  5. <view class="content ml-40 flex-1">
  6. <view class="timestamp" v-if="timestamp">{{timestamp}}</view>
  7. <slot></slot>
  8. </view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'z-timeline',
  15. props: {
  16. bgColor: {
  17. type: String,
  18. default: '#2C8BFF'
  19. },
  20. borderColor: {
  21. type: String,
  22. default: '#D5E8FF'
  23. },
  24. timestamp: String
  25. },
  26. data() {
  27. return {
  28. align: 'center'
  29. }
  30. },
  31. mounted() {
  32. uni.$on('timeline_align', (data) => {
  33. this.align = data;
  34. })
  35. }
  36. }
  37. </script>
  38. <style scoped lang="scss">
  39. .z-time-item {
  40. position: relative;
  41. width: 100%;
  42. .dot {
  43. position: absolute;
  44. z-index: 100;
  45. width: 13rpx;
  46. height: 13rpx;
  47. border-radius: 50%;
  48. }
  49. .content {
  50. .timestamp {
  51. color: #888888;
  52. font-size: 24rpx;
  53. }
  54. }
  55. }
  56. </style>