fix: 修复product/list.vue模板语法错误
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -18,20 +18,10 @@
|
||||
<view class="content-wrapper">
|
||||
<!-- 左侧分类 -->
|
||||
<scroll-view scroll-y class="category-sidebar">
|
||||
<view
|
||||
class="category-item"
|
||||
:class="{ active: !categoryId }"
|
||||
@click="selectCategory('')"
|
||||
>
|
||||
<view class="category-item" :class="{ active: !categoryId }" @click="selectCategory('')">
|
||||
全部
|
||||
</view>
|
||||
<view
|
||||
v-for="cat in categories"
|
||||
:key="cat.categoryId"
|
||||
class="category-item"
|
||||
:class="{ active: categoryId === cat.categoryId }"
|
||||
@click="selectCategory(cat.categoryId)"
|
||||
>
|
||||
<view v-for="cat in categories" :key="cat.categoryId" class="category-item" :class="{ active: categoryId === cat.categoryId }" @click="selectCategory(cat.categoryId)">
|
||||
{{ cat.name }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -39,12 +29,7 @@
|
||||
<!-- 右侧商品列表 -->
|
||||
<scroll-view scroll-y class="product-scroll">
|
||||
<view class="product-list">
|
||||
<view
|
||||
v-for="item in products"
|
||||
:key="item.productId"
|
||||
class="product-card"
|
||||
@click="viewDetail(item)"
|
||||
>
|
||||
<view v-for="item in products" :key="item.productId" class="product-card" @click="viewDetail(item)">
|
||||
<view class="product-image">
|
||||
<Icon name="product" :size="60" color="#fff" />
|
||||
</view>
|
||||
@@ -64,14 +49,11 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view v-if="products.length === 0" class="empty">
|
||||
<Icon name="product" :size="80" color="#ccc" />
|
||||
<text class="empty-text">暂无商品</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-if="products.length > 0" class="load-more">
|
||||
<text>{{ loading ? '加载中...' : (hasMore ? '上拉加载更多' : '没有更多了') }}</text>
|
||||
</view>
|
||||
@@ -119,7 +101,6 @@ export default {
|
||||
async loadProducts() {
|
||||
if (this.loading) return
|
||||
this.loading = true
|
||||
|
||||
try {
|
||||
const res = await productApi.getProducts({
|
||||
categoryId: this.categoryId,
|
||||
@@ -127,7 +108,6 @@ export default {
|
||||
page: this.page,
|
||||
pageSize: this.pageSize
|
||||
})
|
||||
|
||||
const list = res.records || []
|
||||
if (this.page === 1) {
|
||||
this.products = list
|
||||
@@ -166,7 +146,6 @@ export default {
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
/* 搜索区域 */
|
||||
.search-section {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 30rpx 30rpx 10rpx;
|
||||
@@ -192,13 +171,11 @@ export default {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 左侧分类 + 右侧商品布局 */
|
||||
.content-wrapper {
|
||||
display: flex;
|
||||
height: calc(100vh - 130rpx);
|
||||
}
|
||||
|
||||
/* 左侧分类侧边栏 */
|
||||
.category-sidebar {
|
||||
width: 180rpx;
|
||||
background: #fff;
|
||||
@@ -211,7 +188,6 @@ export default {
|
||||
color: #666;
|
||||
text-align: center;
|
||||
border-left: 6rpx solid transparent;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.category-item.active {
|
||||
@@ -221,13 +197,11 @@ export default {
|
||||
border-left-color: #667eea;
|
||||
}
|
||||
|
||||
/* 右侧商品列表 */
|
||||
.product-scroll {
|
||||
flex: 1;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
/* 商品列表 */
|
||||
.product-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -241,17 +215,12 @@ export default {
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.product-card:nth-child(odd) {
|
||||
margin-right: 4%;
|
||||
}
|
||||
|
||||
.product-card:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.product-image {
|
||||
height: 200rpx;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
@@ -325,7 +294,6 @@ export default {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty {
|
||||
width: 100%;
|
||||
padding: 100rpx 0;
|
||||
@@ -340,7 +308,6 @@ export default {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
/* 加载更多 */
|
||||
.load-more {
|
||||
padding: 30rpx;
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user