v2体验版
This commit is contained in:
@@ -35,21 +35,13 @@
|
||||
class="product-image"
|
||||
:src="item.image"
|
||||
mode="aspectFill"
|
||||
lazy-load
|
||||
v-if="item.image"
|
||||
></image>
|
||||
</view>
|
||||
<!-- 商品信息 -->
|
||||
<view class="product-info">
|
||||
<text class="product-name">{{ item.name }}</text>
|
||||
<!-- 标签 - 商品名下方、价格上方 (Figma 1523:344) -->
|
||||
<view class="product-badges" v-if="item.tags && item.tags.length > 0">
|
||||
<view
|
||||
class="product-badge"
|
||||
:style="{ background: tag.bg, color: tag.color }"
|
||||
v-for="(tag, tIdx) in item.tags"
|
||||
:key="tIdx"
|
||||
>{{ tag.text }}</view>
|
||||
</view>
|
||||
<!-- 价格 + "起"字 -->
|
||||
<view class="price-row">
|
||||
<text class="product-price">¥{{ item.price }}</text>
|
||||
@@ -188,19 +180,6 @@ export default {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
/* 标签 - 位于商品名下方、价格上方,横向排列 */
|
||||
.product-badges {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
.product-badge {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 18rpx;
|
||||
}
|
||||
|
||||
/* 商品信息 - 内边距 10px */
|
||||
.product-info {
|
||||
padding: 20rpx;
|
||||
|
||||
@@ -145,9 +145,12 @@ export default {
|
||||
} catch (e) {
|
||||
this.windowHeight = 667
|
||||
}
|
||||
// 首屏商品请求与基础数据并行发出(goods 无筛选时不依赖国家/分类数据),
|
||||
// 避免串行等待拖慢首屏(goods 是最慢的接口,应最先发出)
|
||||
const goodsPromise = this.loadGoods(1)
|
||||
await this.initData()
|
||||
this.loadSubCategories('all')
|
||||
await this.loadGoods(1)
|
||||
await goodsPromise
|
||||
// 首屏数据渲染完成后,子组件会通过 mounted 自行测量并 emit 高度
|
||||
// 这里兜底触发一次重算(防止某些端 mounted 比父组件 onLoad 晚)
|
||||
this.recomputeScrollHeight()
|
||||
@@ -252,14 +255,7 @@ export default {
|
||||
id: item.goodId,
|
||||
name: truncateProductTitle(item.goodName),
|
||||
price: item.price,
|
||||
image: item.image,
|
||||
tags: (item.tags || []).map(function (t) {
|
||||
return {
|
||||
text: t.tagName,
|
||||
bg: t.tagColor,
|
||||
color: t.tagFontColor
|
||||
}
|
||||
})
|
||||
image: item.image
|
||||
}))
|
||||
|
||||
const total = data.total || 0
|
||||
|
||||
Reference in New Issue
Block a user