timeline.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <script setup lang="ts">
  2. import { markRaw } from "vue";
  3. import { randomGradient } from "@pureadmin/utils";
  4. import { useRenderFlicker } from "@/components/ReFlicker";
  5. import { useRenderIcon } from "@/components/ReIcon/src/hooks";
  6. import Iphone from "~icons/ep/iphone";
  7. defineOptions({
  8. name: "TimeLine"
  9. });
  10. const { lastBuildTime } = __APP_INFO__;
  11. const activities = [
  12. {
  13. content: "支持圆点发光",
  14. timestamp: lastBuildTime,
  15. icon: markRaw(useRenderFlicker())
  16. },
  17. {
  18. content: "支持方形发光",
  19. timestamp: lastBuildTime,
  20. icon: markRaw(useRenderFlicker({ borderRadius: 0, background: "#67C23A" }))
  21. },
  22. {
  23. content: "支持渐变发光",
  24. timestamp: lastBuildTime,
  25. icon: markRaw(
  26. useRenderFlicker({
  27. background: randomGradient({
  28. randomizeHue: true
  29. })
  30. })
  31. )
  32. },
  33. {
  34. content: "支持默认颜色",
  35. timestamp: lastBuildTime
  36. },
  37. {
  38. content: "支持自定义颜色",
  39. timestamp: lastBuildTime,
  40. color: "#F56C6C"
  41. },
  42. {
  43. content: "支持自定义图标",
  44. timestamp: lastBuildTime,
  45. color: "transparent",
  46. icon: useRenderIcon(Iphone, {
  47. color: "#0bbd87"
  48. })
  49. }
  50. ];
  51. </script>
  52. <template>
  53. <el-card shadow="never">
  54. <template #header>
  55. <div class="card-header">
  56. <p class="font-medium">时间线</p>
  57. <el-link
  58. class="mt-2"
  59. href="https://github.com/pure-admin/vue-pure-admin/blob/main/src/views/components/timeline.vue"
  60. target="_blank"
  61. >
  62. 代码位置 src/views/components/timeline.vue
  63. </el-link>
  64. </div>
  65. </template>
  66. <div class="flex">
  67. <el-timeline>
  68. <el-timeline-item
  69. v-for="(activity, index) in activities"
  70. :key="index"
  71. :icon="activity.icon"
  72. :color="activity.color"
  73. :timestamp="activity.timestamp"
  74. >
  75. {{ activity.content }}
  76. </el-timeline-item>
  77. </el-timeline>
  78. <el-timeline class="pl-40!">
  79. <el-timeline-item
  80. v-for="(activity, index) in activities"
  81. :key="index"
  82. :icon="activity.icon"
  83. :color="activity.color"
  84. :timestamp="activity.timestamp"
  85. placement="bottom"
  86. >
  87. <div class="message">
  88. vue-pure-admin 第{{ activities.length - index }}个版本发布啦
  89. </div>
  90. </el-timeline-item>
  91. </el-timeline>
  92. </div>
  93. </el-card>
  94. </template>
  95. <style scoped>
  96. .message {
  97. position: relative;
  98. box-sizing: border-box;
  99. width: 200px;
  100. padding: 5px 12px;
  101. line-height: 18px;
  102. color: #fff;
  103. word-break: break-all;
  104. background-color: var(--el-color-primary);
  105. border-color: var(--el-color-primary);
  106. border-radius: 6px;
  107. }
  108. .message::after {
  109. position: absolute;
  110. top: 8px;
  111. left: -10px;
  112. width: 0;
  113. height: 0;
  114. overflow: hidden;
  115. content: "";
  116. border-color: var(--el-color-primary) transparent transparent;
  117. border-style: solid dashed dashed;
  118. border-width: 10px;
  119. }
  120. </style>