| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <view class="section-title" :class="[`align-${align}`]" :style="{ gap: gap }">
- <text
- class="line"
- :style="{
- backgroundColor: lineColor,
- width: lineWidth,
- height: lineHeight,
- }"
- ></text>
- <view
- class="title-text"
- :style="{
- fontSize: fontSize,
- color: color,
- fontWeight: bold ? '700' : '500',
- }"
- >
- <slot>
- <trans :_t="title" v-if="title" />
- </slot>
- </view>
- </view>
- </template>
- <script setup>
- const props = defineProps({
- title: {
- type: String,
- default: "",
- },
- align: {
- type: String,
- default: "left",
- },
- color: {
- type: String,
- default: "var(--text)",
- },
- fontSize: {
- type: String,
- default: "28rpx",
- },
- bold: {
- type: Boolean,
- default: true,
- },
- gap: {
- type: String,
- default: "12rpx",
- },
- lineColor: {
- type: String,
- default: "var(--black)",
- },
- lineWidth: {
- type: String,
- default: "6rpx",
- },
- lineHeight: {
- type: String,
- default: "28rpx",
- },
- });
- </script>
- <style lang="less" scoped>
- .section-title {
- display: flex;
- align-items: center;
- margin: 40rpx 0 32rpx;
- &.align-left {
- justify-content: flex-start;
- }
- &.align-center {
- justify-content: center;
- }
- .line {
- display: inline-block;
- border-radius: 999rpx;
- }
- .title-text {
- display: inline-flex;
- align-items: center;
- }
- }
- </style>
|