item.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <li class="el-timeline-item">
  3. <div class="el-timeline-item__tail"></div>
  4. <div v-if="!$slots.dot"
  5. class="el-timeline-item__node"
  6. :class="[
  7. `el-timeline-item__node--${size || ''}`,
  8. `el-timeline-item__node--${type || ''}`
  9. ]"
  10. :style="{
  11. backgroundColor: color
  12. }"
  13. >
  14. <i v-if="icon"
  15. class="el-timeline-item__icon"
  16. :class="icon"
  17. ></i>
  18. </div>
  19. <div v-if="$slots.dot" class="el-timeline-item__dot">
  20. <slot name="dot"></slot>
  21. </div>
  22. <div class="el-timeline-item__wrapper">
  23. <div v-if="!hideTimestamp && placement === 'top'"
  24. class="el-timeline-item__timestamp is-top">
  25. {{timestamp}}
  26. </div>
  27. <div class="el-timeline-item__content">
  28. <slot></slot>
  29. </div>
  30. <div v-if="!hideTimestamp && placement === 'bottom'"
  31. class="el-timeline-item__timestamp is-bottom">
  32. {{timestamp}}
  33. </div>
  34. </div>
  35. </li>
  36. </template>
  37. <script>
  38. export default {
  39. name: 'ElTimelineItem',
  40. inject: ['timeline'],
  41. props: {
  42. timestamp: String,
  43. hideTimestamp: {
  44. type: Boolean,
  45. default: false
  46. },
  47. placement: {
  48. type: String,
  49. default: 'bottom'
  50. },
  51. type: String,
  52. color: String,
  53. size: {
  54. type: String,
  55. default: 'normal'
  56. },
  57. icon: String
  58. }
  59. };
  60. </script>