平安校园
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 1.2 KiB

4 달 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!--
  2. * @Description: 代码高亮组件
  3. * @Author: huguodong
  4. * @Date: 2023-12-15 15:37:43
  5. !-->
  6. <template>
  7. <div :codetype="props.language">
  8. <highlightjs :language="props.language" :autodetect="!props.language" :code="props.code"></highlightjs>
  9. </div>
  10. </template>
  11. <script setup lang="ts" name="codeHighLight">
  12. const props = defineProps({
  13. language: {
  14. type: String,
  15. default: () => undefined
  16. },
  17. code: {
  18. type: String,
  19. default: () => "无"
  20. }
  21. });
  22. </script>
  23. <style lang="scss" scoped>
  24. /** 滚动条 */
  25. :deep(.hljs, .hljs-container) {
  26. max-height: 300px !important;
  27. overflow-x: auto;
  28. }
  29. :deep(.hljs::-webkit-scrollbar) {
  30. width: 12px !important;
  31. height: 12px !important;
  32. }
  33. :deep(.hljs::-webkit-scrollbar-thumb) {
  34. height: 30px !important;
  35. background: #d1d8e6;
  36. background-clip: content-box;
  37. border: 2px solid transparent;
  38. border-radius: 19px;
  39. opacity: 0.8;
  40. }
  41. :deep(.hljs::-webkit-scrollbar-thumb:hover) {
  42. background: #a5b3cf;
  43. background-clip: content-box;
  44. border: 2px solid transparent;
  45. }
  46. :deep(.hljs::-webkit-scrollbar-track-piece) {
  47. width: 30px;
  48. height: 30px;
  49. background: #333333;
  50. }
  51. ::-webkit-scrollbar-button {
  52. display: none;
  53. }
  54. </style>