文件
xionggeshop/xgsc.gynhc.com_wx/pages/index/components/sh-title-card.vue
2026-09-14 17:24:53 +08:00

124 行
2.3 KiB
Vue

<template>
<view class="sh-title-card" :class="'sh-title-card--' + variant">
<view class="section-head u-flex u-row-between u-col-center">
<view class="section-head__main u-flex u-col-center">
<view class="section-head__line" v-if="variant === 'center'"></view>
<text class="section-head__title" :style="{ color: titleColor || '' }">{{ title }}</text>
<view class="section-head__line" v-if="variant === 'center'"></view>
</view>
<text v-if="variant === 'section' && showMore" class="section-head__more" @tap="onMore">查看更多</text>
</view>
<text class="section-head__sub" v-if="subtitle">{{ subtitle }}</text>
</view>
</template>
<script>
export default {
props: {
bgImage: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
titleColor: {
type: String,
default: ''
},
subtitle: {
type: String,
default: ''
},
variant: {
type: String,
default: 'center'
},
showMore: {
type: Boolean,
default: true
}
},
methods: {
onMore() {
this.$Router.push('/pages/goods/list');
}
}
};
</script>
<style lang="scss">
.sh-title-card {
width: 100%;
box-sizing: border-box;
}
.sh-title-card--center {
padding: 32rpx $brand-page-gutter 8rpx;
}
.sh-title-card--section {
padding: 24rpx $brand-page-gutter 20rpx;
}
.section-head {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
}
.section-head__main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: row;
align-items: center;
}
.sh-title-card--center .section-head__main {
justify-content: center;
}
.sh-title-card--section .section-head__main {
justify-content: flex-start;
}
.section-head__more {
flex-shrink: 0;
margin-left: 16rpx;
font-size: 24rpx;
color: $brand-text-muted;
}
.section-head__line {
flex: 1;
max-width: 120rpx;
height: 1rpx;
background: linear-gradient(90deg, transparent, rgba(5, 150, 105, 0.45), transparent);
}
.section-head__title {
font-size: 34rpx;
font-weight: 700;
color: $brand-text;
letter-spacing: 1rpx;
white-space: nowrap;
}
.sh-title-card--center .section-head__title {
margin: 0 24rpx;
}
.section-head__sub {
display: block;
margin-top: 8rpx;
text-align: center;
font-size: 20rpx;
color: $brand-text-muted;
letter-spacing: 6rpx;
opacity: 0.75;
}
</style>