2023-12-19 15:10:50 +00:00
|
|
|
|
<!-- 装修商品组件:标题栏 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
|
<template>
|
2024-10-27 10:22:47 +00:00
|
|
|
|
<view
|
|
|
|
|
class="ss-title-wrap ss-flex ss-col-center"
|
|
|
|
|
:class="[state.typeMap[data.textAlign]]"
|
|
|
|
|
:style="[bgStyle, { marginLeft: `${data.space}px` }]"
|
|
|
|
|
>
|
|
|
|
|
<view class="title-content">
|
|
|
|
|
<!-- 主标题 -->
|
2024-12-05 07:38:40 +00:00
|
|
|
|
<view
|
|
|
|
|
v-if="data.title"
|
|
|
|
|
:style="{
|
|
|
|
|
fontSize: `${data.titleSize}px`,
|
|
|
|
|
fontWeight: data.titleWeight,
|
|
|
|
|
color: data.titleColor,
|
|
|
|
|
textAlign: data.textAlign
|
|
|
|
|
}"
|
|
|
|
|
class="title-text"
|
|
|
|
|
>
|
|
|
|
|
{{ data.title }}
|
|
|
|
|
</view>
|
2024-10-27 10:22:47 +00:00
|
|
|
|
<!-- 副标题 -->
|
2024-12-05 07:38:40 +00:00
|
|
|
|
<view
|
|
|
|
|
v-if="data.description"
|
|
|
|
|
:style="{
|
|
|
|
|
fontSize: `${data.descriptionSize}px`,
|
|
|
|
|
fontWeight: data.descriptionWeight,
|
|
|
|
|
color: data.descriptionColor,
|
|
|
|
|
textAlign: data.textAlign
|
|
|
|
|
}"
|
|
|
|
|
class="sub-title-text"
|
|
|
|
|
>
|
|
|
|
|
{{ data.description }}
|
|
|
|
|
</view>
|
2024-10-27 10:22:47 +00:00
|
|
|
|
</view>
|
|
|
|
|
<!-- 查看更多 -->
|
|
|
|
|
<view
|
|
|
|
|
v-if="data.more?.show"
|
|
|
|
|
class="more-box ss-flex ss-col-center"
|
|
|
|
|
@tap="sheep.$router.go(data.more.url)"
|
|
|
|
|
:style="{ color: data.descriptionColor }"
|
|
|
|
|
>
|
2024-12-05 07:38:40 +00:00
|
|
|
|
<view v-if="data.more.type !== 'icon'" class="more-text">{{ data.more.text }}</view>
|
2024-10-27 10:22:47 +00:00
|
|
|
|
<text class="_icon-forward" v-if="data.more.type !== 'text'"></text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-10-27 10:22:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* 标题栏
|
|
|
|
|
*/
|
2024-12-05 07:38:40 +00:00
|
|
|
|
import { computed, reactive } from 'vue';
|
2024-10-27 10:22:47 +00:00
|
|
|
|
import sheep from '@/sheep';
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2024-10-27 10:22:47 +00:00
|
|
|
|
// 数据
|
|
|
|
|
const state = reactive({
|
|
|
|
|
typeMap: {
|
|
|
|
|
left: 'ss-row-left',
|
|
|
|
|
center: 'ss-row-center',
|
|
|
|
|
},
|
|
|
|
|
});
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2024-10-27 10:22:47 +00:00
|
|
|
|
// 接收参数
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
// 装修数据
|
|
|
|
|
data: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => ({}),
|
|
|
|
|
},
|
|
|
|
|
// 装修样式
|
|
|
|
|
styles: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => ({}),
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
// 设置背景样式
|
|
|
|
|
const bgStyle = computed(() => {
|
|
|
|
|
// 直接从 props.styles 解构
|
|
|
|
|
const { bgType, bgImg, bgColor } = props.styles;
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2024-10-27 10:22:47 +00:00
|
|
|
|
// 根据 bgType 返回相应的样式
|
|
|
|
|
return {
|
|
|
|
|
background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor,
|
|
|
|
|
};
|
|
|
|
|
});
|
2022-11-22 07:45:36 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2024-10-27 10:22:47 +00:00
|
|
|
|
.ss-title-wrap {
|
2024-12-05 07:38:40 +00:00
|
|
|
|
min-height: 80rpx;
|
2024-10-27 10:22:47 +00:00
|
|
|
|
position: relative;
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
2024-10-27 10:22:47 +00:00
|
|
|
|
.more-box {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: #999;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
right: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|