changelog.tpl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. ul {
  55. padding-left: 20px;
  56. li::before {
  57. content: '';
  58. circle: 4px #fff;
  59. border: solid 1px #5e6d82;
  60. margin-right: 5px;
  61. display: inline-block;
  62. vertical-align: middle;
  63. }
  64. }
  65. }
  66. li li {
  67. font-size: 14px;
  68. list-style: none;
  69. padding-left: 0;
  70. word-break: break-all;
  71. &:before {
  72. content: '';
  73. circle: 4px #5e6d82;
  74. margin-right: 5px;
  75. display: inline-block;
  76. vertical-align: middle;
  77. }
  78. }
  79. h3 {
  80. margin: 0 0 10px;
  81. &:before {
  82. content: '';
  83. display: block;
  84. position: absolute;
  85. left: -31px;
  86. top: 13px;
  87. circle: 13px transparent;
  88. border: 2px solid #20a0ff;
  89. box-sizing: border-box;
  90. background-color: #fff;
  91. }
  92. a {
  93. opacity: 1;
  94. float: none;
  95. margin-left: 0;
  96. color: inherit;
  97. }
  98. }
  99. h4 {
  100. margin: 50px 0 10px;
  101. }
  102. p {
  103. margin: 0;
  104. }
  105. em {
  106. position: absolute;
  107. left: -127px;
  108. font-style: normal;
  109. top: 6px;
  110. font-size: 14px;
  111. color: #99a9bf;
  112. }
  113. }
  114. }
  115. </style>
  116. <template>
  117. <div class="page-changelog">
  118. <div class="heading">
  119. <el-button class="fr">
  120. <a href="https://github.com/ElemeFE/element/releases" target="_blank">Github Releases</a>
  121. </el-button>
  122. <%= 1 >
  123. </div>
  124. <ul class="timeline" ref="timeline">
  125. </ul>
  126. <change-log ref="changeLog"></change-log>
  127. </div>
  128. </template>
  129. <script>
  130. import ChangeLog from '../../../CHANGELOG.<%= 2 >.md';
  131. export default {
  132. components: {
  133. ChangeLog
  134. },
  135. data() {
  136. return {
  137. count: 3
  138. };
  139. },
  140. mounted() {
  141. const changeLog = this.$refs.changeLog;
  142. const changeLogNodes = changeLog.$el.children;
  143. let a = changeLogNodes[1].querySelector('a');
  144. a && a.remove();
  145. let release = changeLogNodes[1].textContent.trim();
  146. let fragments = `<li><h3><a href="https://github.com/ElemeFE/element/releases/tag/v${release}" target="_blank">${release}</a></h3>`;
  147. for (let len = changeLogNodes.length, i = 2; i < len; i++) {
  148. let node = changeLogNodes[i];
  149. a = changeLogNodes[i].querySelector('a');
  150. a && a.getAttribute('class') === 'header-anchor' && a.remove();
  151. if (node.tagName !== 'H3') {
  152. fragments += changeLogNodes[i].outerHTML;
  153. } else {
  154. release = changeLogNodes[i].textContent.trim();
  155. fragments += `</li><li><h3><a href="https://github.com/ElemeFE/element/releases/tag/v${release}" target="_blank">${release}</a></h3>`;
  156. }
  157. }
  158. fragments = fragments.replace(/#(\d+)/g, '<a href="https://github.com/ElemeFE/element/issues/$1" target="_blank">#$1</a>');
  159. fragments = fragments.replace(/@(\w+)/g, '<a href="https://github.com/$1" target="_blank">@$1</a>');
  160. this.$refs.timeline.innerHTML = `${fragments}</li>`;
  161. changeLog.$el.remove();
  162. }
  163. };
  164. </script>