BorderLine.vue 1.3 KB

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