2022-11-22 07:45:36 +00:00
|
|
|
|
<template>
|
2023-12-01 16:51:58 +00:00
|
|
|
|
<view class="wrap" :style="{height: `${height}px`}">
|
|
|
|
|
<view class="divider" :style="[elStyle]"></view>
|
|
|
|
|
</view>
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
/**
|
2023-12-01 16:51:58 +00:00
|
|
|
|
* 分割线
|
2022-11-22 07:45:36 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { computed } from 'vue';
|
|
|
|
|
|
|
|
|
|
// 接收参数
|
|
|
|
|
const props = defineProps({
|
2023-12-01 16:51:58 +00:00
|
|
|
|
// 线条颜色
|
|
|
|
|
lineColor: {
|
2022-11-22 07:45:36 +00:00
|
|
|
|
type: String,
|
|
|
|
|
default: '#000',
|
|
|
|
|
},
|
2023-12-01 16:51:58 +00:00
|
|
|
|
// 线条样式:'dotted', 'solid', 'double', 'dashed'
|
|
|
|
|
borderType: {
|
2022-11-22 07:45:36 +00:00
|
|
|
|
type: String,
|
|
|
|
|
default: 'dashed',
|
|
|
|
|
},
|
2023-12-01 16:51:58 +00:00
|
|
|
|
// 线条宽度
|
|
|
|
|
lineWidth: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 1,
|
|
|
|
|
},
|
|
|
|
|
// 高度
|
|
|
|
|
height: {
|
|
|
|
|
type: [Number, String],
|
|
|
|
|
default: 'auto'
|
2022-11-22 07:45:36 +00:00
|
|
|
|
},
|
2023-12-01 16:51:58 +00:00
|
|
|
|
// 左右边距:none - 无边距,horizontal - 左右留边
|
|
|
|
|
paddingType: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'none'
|
|
|
|
|
}
|
2022-11-22 07:45:36 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const elStyle = computed(() => {
|
|
|
|
|
return {
|
2023-12-01 16:51:58 +00:00
|
|
|
|
'border-top-width': `${props.lineWidth}px`,
|
|
|
|
|
'border-top-color': props.lineColor,
|
|
|
|
|
'border-top-style': props.borderType,
|
|
|
|
|
margin: props.paddingType === 'none' ? '0' : '0px 16px'
|
2022-11-22 07:45:36 +00:00
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-12-01 16:51:58 +00:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.wrap {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
.divider {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|