changelog.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <style>
  2. .page-changelog {
  3. padding-bottom: 100px;
  4. .fr {
  5. float: right;
  6. padding: 0;
  7. a {
  8. display: block;
  9. padding: 10px 15px;
  10. color: #475669;
  11. }
  12. &:hover a {
  13. color: #20a0ff;
  14. }
  15. }
  16. .heading {
  17. margin-bottom: 40px;
  18. }
  19. .timeline {
  20. margin: 0 0 0 105px;
  21. padding-left: 25px;
  22. position: relative;
  23. color: #5e6d82;
  24. &:before {
  25. content: '';
  26. width: 1px;
  27. height: 100%;
  28. position: absolute;
  29. left: 0;
  30. top: 10px;
  31. background-color: #eaeefa;
  32. }
  33. > li {
  34. list-style: none;
  35. position: relative;
  36. line-height: 1.8;
  37. &:not(:last-child) {
  38. margin-bottom: 50px;
  39. }
  40. &:first-child {
  41. margin-top: -10px;
  42. h3:before {
  43. left: -33px;
  44. top: 10px;
  45. width: 17px;
  46. height: @width;
  47. background-color: #20a0ff;
  48. border: 0;
  49. }
  50. }
  51. }
  52. ul {
  53. padding-left: 0;
  54. }
  55. li li {
  56. font-size: 14px;
  57. list-style: none;
  58. padding-left: 0;
  59. &:before {
  60. content: '';
  61. circle: 4px #5e6d82;
  62. margin-right: 5px;
  63. display: inline-block;
  64. vertical-align: middle;
  65. }
  66. }
  67. h3 {
  68. margin: 0 0 10px;
  69. &:before {
  70. content: '';
  71. display: block;
  72. position: absolute;
  73. left: -31px;
  74. top: 13px;
  75. circle: 13px transparent;
  76. border: 2px solid #20a0ff;
  77. box-sizing: border-box;
  78. background-color: #fff;
  79. }
  80. a {
  81. opacity: 1;
  82. float: none;
  83. margin-left: 0;
  84. color: inherit;
  85. }
  86. }
  87. h4 {
  88. margin: 50px 0 10px;
  89. }
  90. p {
  91. margin: 0;
  92. }
  93. em {
  94. position: absolute;
  95. left: -127px;
  96. font-style: normal;
  97. top: 6px;
  98. font-size: 14px;
  99. color: #99a9bf;
  100. }
  101. }
  102. }
  103. </style>
  104. <template>
  105. <div class="page-changelog">
  106. <div class="heading">
  107. <el-button class="fr">
  108. <a href="https://github.com/ElemeFE/element/releases" target="_blank">Github Releases</a>
  109. </el-button>
  110. 更新日志
  111. </div>
  112. <ul class="timeline" ref="timeline">
  113. </ul>
  114. <change-log ref="changeLog"></change-log>
  115. </div>
  116. </template>
  117. <script>
  118. import ChangeLog from '../../../CHANGELOG.zh-CN.md';
  119. export default {
  120. components: {
  121. ChangeLog
  122. },
  123. data() {
  124. return {
  125. count: 3
  126. };
  127. },
  128. mounted() {
  129. const changeLog = this.$refs.changeLog;
  130. const changeLogNodes = changeLog.$el.children;
  131. let a = changeLogNodes[1].querySelector('a');
  132. a && a.remove();
  133. let release = changeLogNodes[1].textContent.trim();
  134. let fragments = `<li><h3><a href="https://github.com/ElemeFE/element/releases/tag/v${release}" target="_blank">${release}</a></h3>`;
  135. for (let len = changeLogNodes.length, i = 2; i < len; i++) {
  136. let node = changeLogNodes[i];
  137. a = changeLogNodes[i].querySelector('a');
  138. a && a.remove();
  139. if (node.tagName !== 'H3') {
  140. fragments += changeLogNodes[i].outerHTML;
  141. } else {
  142. release = changeLogNodes[i].textContent.trim();
  143. fragments += `</li><li><h3><a href="https://github.com/ElemeFE/element/releases/tag/v${release}" target="_blank">${release}</a></h3>`;
  144. }
  145. }
  146. fragments = fragments.replace(/#(\d+)/g, '<a href="https://github.com/ElemeFE/element/issues/$1" target="_blank">#$1</a>');
  147. this.$refs.timeline.innerHTML = `${fragments}</li>`;
  148. changeLog.$el.remove();
  149. }
  150. };
  151. </script>