2022-11-22 07:45:36 +00:00
|
|
|
<!-- 页面 -->
|
|
|
|
<template>
|
|
|
|
<view
|
|
|
|
class="ss-title-wrap ss-flex ss-col-center"
|
2023-12-15 05:26:27 +00:00
|
|
|
:class="[state.typeMap[data.textAlign]]"
|
2022-11-22 07:45:36 +00:00
|
|
|
:style="[elStyles]"
|
|
|
|
>
|
|
|
|
<view class="title-content">
|
2023-12-15 05:26:27 +00:00
|
|
|
<!-- 主标题 -->
|
|
|
|
<view v-if="data.title" class="title-text" :style="[titleStyles]">{{ data.title }}</view>
|
|
|
|
<!-- 副标题 -->
|
|
|
|
<view v-if="data.description" :style="[descStyles]" class="sub-title-text">{{ data.description }}</view>
|
2022-11-22 07:45:36 +00:00
|
|
|
</view>
|
2023-12-15 05:26:27 +00:00
|
|
|
<!-- 查看更多 -->
|
|
|
|
<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}">
|
|
|
|
<view class="more-text" v-if="data.more.type !== 'icon'">{{ data.more.text }} </view>
|
|
|
|
<text class="_icon-forward" v-if="data.more.type !== 'text'"></text>
|
2022-11-22 07:45:36 +00:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
/**
|
|
|
|
* 标题栏
|
|
|
|
*/
|
2023-12-15 05:26:27 +00:00
|
|
|
import { reactive } from 'vue';
|
2022-11-22 07:45:36 +00:00
|
|
|
import sheep from '@/sheep';
|
|
|
|
|
|
|
|
// 数据
|
|
|
|
const state = reactive({
|
|
|
|
typeMap: {
|
|
|
|
left: 'ss-row-left',
|
|
|
|
center: 'ss-row-center',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// 接收参数
|
|
|
|
const props = defineProps({
|
|
|
|
data: {
|
|
|
|
type: Object,
|
|
|
|
default() {},
|
|
|
|
},
|
|
|
|
styles: {
|
|
|
|
type: Object,
|
|
|
|
default() {},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
// 组件样式
|
|
|
|
const elStyles = {
|
2023-12-15 05:26:27 +00:00
|
|
|
background: `url(${sheep.$url.cdn(props.data.bgImgUrl)}) no-repeat top center / 100% auto`,
|
|
|
|
fontSize: `${props.data.titleSize}px`,
|
|
|
|
fontWeight: `${props.data.titleWeight}px`,
|
2022-11-22 07:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// 标题样式
|
|
|
|
const titleStyles = {
|
2023-12-15 05:26:27 +00:00
|
|
|
color: props.data.titleColor,
|
|
|
|
fontSize: `${props.data.titleSize}px`,
|
|
|
|
textAlign: props.data.textAlign
|
2022-11-22 07:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// 副标题
|
2023-12-15 05:26:27 +00:00
|
|
|
const descStyles = {
|
|
|
|
color: props.data.descriptionColor,
|
|
|
|
textAlign: props.data.textAlign,
|
|
|
|
fontSize: `${props.data.descriptionSize}px`,
|
|
|
|
fontWeight: `${props.data.descriptionWeight}px`,
|
2022-11-22 07:45:36 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ss-title-wrap {
|
|
|
|
height: 80rpx;
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
.title-content {
|
|
|
|
.title-text {
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sub-title-text {
|
|
|
|
font-size: 22rpx;
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.more-box {
|
|
|
|
white-space: nowrap;
|
|
|
|
font-size: 22rpx;
|
|
|
|
color: #999;
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
right: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|