You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
<template> |
|
<div class="crossed-lines-container"> |
|
<!-- 上边线 --> |
|
<div |
|
class="line horizontal-line" |
|
:style="{ width: (horizontalLength / 100) + 'rem', left: `calc(50% - ${horizontalLength / 200}rem)`, top: `calc(50% - ${(verticalLength / 200) - (overlap / 100)}rem)` }" |
|
></div> |
|
<!-- 右边线 --> |
|
<div |
|
class="line vertical-line" |
|
:style="{ height: (verticalLength / 100) + 'rem', top: `calc(50% - ${verticalLength / 200}rem)`, left: `calc(50% + ${(horizontalLength / 200) - (overlap / 100)}rem)` }" |
|
></div> |
|
<!-- 下边线 --> |
|
<div |
|
class="line horizontal-line" |
|
:style="{ width: (horizontalLength / 100) + 'rem', left: `calc(50% - ${horizontalLength / 200}rem)`, top: `calc(50% + ${(verticalLength / 200) - (overlap / 100)}rem)` }" |
|
></div> |
|
<!-- 左边线 --> |
|
<div |
|
class="line vertical-line" |
|
:style="{ height: (verticalLength / 100) + 'rem', top: `calc(50% - ${verticalLength / 200}rem)`, left: `calc(50% - ${(horizontalLength / 200) - (overlap / 100)}rem)` }" |
|
></div> |
|
</div> |
|
</template> |
|
|
|
<script> |
|
export default { |
|
props: { |
|
// 水平方向(上下边)的直线长度 |
|
horizontalLength: { |
|
type: Number, |
|
default: 100 |
|
}, |
|
// 垂直方向(左右边)的直线长度 |
|
verticalLength: { |
|
type: Number, |
|
default: 100 |
|
}, |
|
// 直线交叉时超出的长度 |
|
overlap: { |
|
type: Number, |
|
default: 10 |
|
} |
|
} |
|
}; |
|
</script> |
|
|
|
<style scoped> |
|
.crossed-lines-container { |
|
position: relative; |
|
width: 100%; |
|
height: 100%; |
|
} |
|
|
|
.line { |
|
position: absolute; |
|
background-color: rgb(45, 121, 236,0.7); |
|
} |
|
|
|
.horizontal-line { |
|
height: 0.01rem; |
|
} |
|
|
|
.vertical-line { |
|
width: 0.01rem; |
|
} |
|
</style> |