Files
inkreach-uni/pages/product-detail/components/SizeSelector.vue
T
2026-08-21 19:02:35 +08:00

88 lines
1.6 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 个按钮横排选中态橙色边框+橙色文字背景仍为浅灰 -->
<view class="size-wrap">
<text class="title">尺码</text>
<view class="size-list">
<view
v-for="(item, index) in list"
:key="index"
class="size-item"
:class="{ active: selected === item }"
@tap="selectSize(item)"
>
<text class="size-text">{{ item }}</text>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'SizeSelector',
props: {
list: {
type: Array,
default: () => []
},
selected: {
type: String,
default: ''
}
},
methods: {
selectSize(size) {
this.$emit('select', size)
}
}
}
</script>
<style scoped>
.size-wrap {
padding: 30rpx 20rpx; /* 15px 10px */
background: #ffffff;
}
/* 标题 */
.title {
display: block;
font-size: 29rpx; /* 15px */
color: #000000;
line-height: 33rpx;
margin-bottom: 30rpx; /* 15px */
}
/* 尺码列表横排 */
.size-list {
display: flex;
gap: 12rpx; /* 6px */
}
/* 单个尺码按钮 44x34,圆角 4px,背景 #F7F7F7 */
.size-item {
width: 85rpx; /* 44px */
height: 65rpx; /* 34px */
display: flex;
align-items: center;
justify-content: center;
background: #f7f7f7;
border: 1rpx solid transparent;
border-radius: 8rpx; /* 4px */
}
/* 选中:橙色边框 + 橙色文字(背景保持 #F7F7F7) */
.size-item.active {
border-color: #ff6800;
}
.size-text {
font-size: 25rpx; /* 13px */
color: #000000;
line-height: 33rpx;
}
.size-item.active .size-text {
color: #ff6800;
}
</style>