Files
inkreach-uni/pages/product-detail/components/SizeChart.vue
T

118 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<!-- 产品尺码表5 × 4 交替行背景 -->
<view class="chart-wrap">
<view class="header-row">
<text class="title">产品尺码</text>
<!-- 单位小字设计稿 1566-116011px Medium 50%与标题底对齐 -->
<text class="unit">单位cm</text>
</view>
<view class="table">
<!-- 表头bg #DFDFDF圆角 6px -->
<view class="row header">
<text
class="cell"
v-for="(col, index) in data.columns"
:key="index"
>{{ col }}</text>
</view>
<!-- 数据行偶数行 24 bg #F7F7F7圆角 6px -->
<view
class="row"
:class="{ alt: (index + 1) % 2 === 0 }"
v-for="(row, index) in data.rows"
:key="index"
>
<text class="cell">{{ row.size }}</text>
<text class="cell">{{ row.shoulder }}</text>
<text class="cell">{{ row.chest }}</text>
<text class="cell">{{ row.length }}</text>
<text class="cell">{{ row.sleeve }}</text>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'SizeChart',
props: {
data: {
type: Object,
default: () => ({})
}
}
}
</script>
<style scoped>
.chart-wrap {
padding: 30rpx 20rpx; /* 15px 10px */
background: #ffffff;
}
/* 标题行:产品尺码(左) + 单位(右),按文字基线对齐(字下边界齐平) */
.header-row {
display: flex;
align-items: baseline;
margin-bottom: 20rpx; /* 10px */
}
.title {
font-size: 29rpx; /* 15px */
color: #000000;
line-height: 33rpx;
}
/* 单位小字:紧接标题右侧(不靠右对齐),11px → 21rpx,行高 17px → 33rpx,黑色 50% 透明 */
.unit {
margin-left: 12rpx;
font-size: 21rpx;
font-weight: 500;
color: #000000;
opacity: 0.5;
line-height: 33rpx;
}
/* 表格 */
.table {
display: flex;
flex-direction: column;
gap: 8rpx; /* 行间距 4px */
}
/* 单行 */
.row {
display: flex;
height: 77rpx; /* 40px */
align-items: center;
border-radius: 12rpx; /* 6px */
}
/* 表头行 */
.row.header {
background: #dfdfdf;
}
/* 偶数行(交替背景) */
.row.alt {
background: #f7f7f7;
}
/* 单元格:等宽分布 */
.cell {
flex: 1;
text-align: center;
font-size: 25rpx; /* 13px */
color: #000000;
line-height: 33rpx;
}
.row.header .cell {
color: #000000;
}
.row:not(.header) .cell {
opacity: 0.6;
}
.row:not(.header) .cell:first-child {
opacity: 1; /* 尺码列不透明 */
}
</style>