Card.nvue 1.61 KB
<template>
	<view class="h-card" :style="{height:autoHeight?'':props.height,padding:cardPadding}">
		<view class="h-card_title" v-if="props.title" :style="titleStyle">
			<!-- // <text class="text">{{ props.title }}</text> -->
          <uv-text bold :text="props.title" align="left" size="32rpx" color="#202328" :lines="1"></uv-text>
			<image v-if="titleIcon" src="@/static/tabbar/h-title_bg.png" class="img" mode=""></image>
			<slot name="filter" />
		</view>
		<view class="h-card_content" :style="autoHeight?'':'flex:1'">
			<slot name="content" />
		</view>
	</view>
</template>

<script setup>
	const props = defineProps({
		title: {
			type: String,
			default: ''
		},
    cardPadding:{
      type:String,
      default: '28rpx'
    },
		autoHeight: {
			type: Boolean,
			default: false
		},
		height: {
			type: String,
			default: '506rpx'
		},
		titleIcon: {
			type: Boolean,
			default: false
		},
    titleStyle:{
      type: Object,
			default: () => ({
        paddingLeft:0
      })
    }
	})
</script>

<style lang="scss" scoped>
	.h-card {
		width: 710rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		overflow: hidden;
		display: flex;
		flex-direction: column;

		&_title {
			display: flex;
			flex-direction: column;
			position: relative;
			flex-direction: row;
			justify-content: space-between;

			.text {
				color: #202328;
				font-size: 32rpx;
				font-family: PingFang_Bold;
				line-height: 44rpx;
        		font-weight: bold;
				flex:1;		
			}

			.img {
				width: 75px;
				height: 10px;
				position: absolute;
				bottom: 6rpx;
				left: 14rpx;
			}
		}

		&_content{
			min-height: 0;
		}
	}
</style>