LineOfCode.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div class="line-wrap" :style="{background : color}" :class="{'first-line' : isFirst, 'last-line' : isLast}">
  3. <pre :id="text" v-bind:class="{ 'match-line' : color !== '#ECECEC' }">{{ lineNumber }} {{ text }}</pre>
  4. </div>
  5. </template>
  6. <script>
  7. import { defineComponent } from "vue";
  8. export default defineComponent({
  9. name: "LineOfCode",
  10. props: {
  11. text: {
  12. type: String,
  13. required: true
  14. },
  15. lineNumber: {
  16. type: Number,
  17. required: true
  18. },
  19. color: {
  20. required:true
  21. },
  22. startOfMatch: {
  23. type: Number
  24. },
  25. fileIndex: {
  26. type: Number,
  27. },
  28. isFirst: {
  29. type: Boolean,
  30. },
  31. isLast: {
  32. type: Boolean,
  33. }
  34. },
  35. setup(props) {
  36. console.log(props.color)
  37. return {
  38. }
  39. }
  40. })
  41. </script>
  42. <style scoped>
  43. pre {
  44. margin: 0;
  45. padding: 0;
  46. float: left;
  47. font-family: "JetBrains Mono",serif;
  48. font-size: x-small;
  49. }
  50. .first-line {
  51. margin-top: 2%;
  52. }
  53. .last-line {
  54. margin-bottom: 2%;
  55. box-shadow: #777777 0 3px 3px;
  56. }
  57. .match-line {
  58. }
  59. .line-wrap {
  60. width: 200%;
  61. }
  62. </style>