BorderLine.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div :class="['border-line', type, { 'wide': isWide }]"></div>
  3. </template>
  4. <script lang="ts" setup>
  5. import type { OperateBorderLines } from '@/types/edit'
  6. withDefaults(defineProps<{
  7. type: OperateBorderLines
  8. isWide?: boolean
  9. }>(), {
  10. isWide: false
  11. })
  12. </script>
  13. <style lang="scss" scoped>
  14. .border-line {
  15. position: absolute;
  16. width: 0;
  17. height: 0;
  18. left: 0;
  19. top: 0;
  20. border: 0 dashed $themeColor;
  21. &.top {
  22. border-top-width: 1px;
  23. }
  24. &.bottom {
  25. border-bottom-width: 1px;
  26. }
  27. &.left {
  28. border-left-width: 1px;
  29. }
  30. &.right {
  31. border-right-width: 1px;
  32. }
  33. &.wide {
  34. &::before {
  35. content: '';
  36. position: absolute;
  37. background: transparent;
  38. cursor: move;
  39. }
  40. &.top::before {
  41. top: -8px;
  42. left: -8px;
  43. width: calc(100% + 16px);
  44. height: 16px;
  45. }
  46. &.bottom::before {
  47. bottom: -8px;
  48. left: -8px;
  49. width: calc(100% + 16px);
  50. height: 16px;
  51. }
  52. &.left::before {
  53. top: -8px;
  54. left: -8px;
  55. width: 16px;
  56. height: calc(100% + 16px);
  57. }
  58. &.right::before {
  59. top: -8px;
  60. right: -8px;
  61. width: 16px;
  62. height: calc(100% + 16px);
  63. }
  64. }
  65. }
  66. </style>