<template>
<view class="u-section">
<view
class="u-section-title"
:style="{
fontWeight: bold ? 'bold' : 'normal',
color: color,
fontSize: fontSize + 'rpx',
paddingLeft: showLine ? '5rpx' : 0
}"
:class="{
'u-section--line': showLine
}"
>{{title}}</view>
<view class="u-right-info" v-if="right" :style="{
color: subColor
}" @tap="rightClick">
{{subTitle}}
<view class="u-icon-arrow">
<u-icon name="arrow-right" size="12" :color="subColor"></u-icon>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'u-section',
props: {
title: {
type: String,
default: ''
},
subTitle: {
type: String,
default: '更多'
},
right: {
type: Boolean,
default: true
},
fontSize: {
type: [Number, String],
default: 14
},
bold: {
type: Boolean,
default: true
},
color: {
type: String,
default: '#303133'
},
subColor: {
type: String,
default: '#909399'
},
showLine: {
type: Boolean,
default: true
}
},
data() {
return {}
},
methods: {
rightClick() {
this.$emit('click')
}
}
}
</script>
<style lang="scss" scoped>
@import '../../libs/css/style.components.scss';
.u-section {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.u-section-title {
position: relative;
font-size: 14rpx;
line-height: 1;
}
.u-section--line:after {
position: absolute;
width: 4px;
height: 100%;
content: '';
left: 0;
border-radius: 10px;
background-color: currentColor;
}
.u-right-info {
color: $u-tips-color;
font-size: 13rpx;
display: flex;
align-items: center;
}
.u-icon-arrow {
margin-left: 6rpx;
}
</style>