changelog.tpl 3.7 KB

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