Fix:5371 【商城小程序】甄选好礼对应分类下无商品不会提示
This commit is contained in:
+22
-4
@@ -36,7 +36,7 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="product-wrap v12-mt-3">
|
||||
<view v-if="products.length > 0" class="product-wrap v12-mt-3">
|
||||
<view class="product-card" v-for="(item, index) in products" :key="index" @click="toGoods(item)">
|
||||
<image :src="item.productImage" class="product-card-img" mode="heightFix|widthFix"></image>
|
||||
<view class="new-info">
|
||||
@@ -53,6 +53,9 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="empty-wrap">
|
||||
<view class="empty-text">暂无数据</view>
|
||||
</view>
|
||||
<ProductWindow
|
||||
ref="attrWindow"
|
||||
:attr="attr"
|
||||
@@ -99,8 +102,12 @@ export default{
|
||||
onLoad() {
|
||||
queryNewZone().then(res => {
|
||||
this.details = res.data
|
||||
this.tabs = res.data.categories
|
||||
this.handleClick(0, this.tabs[0])
|
||||
this.tabs = Array.isArray(res.data.categories) ? res.data.categories : []
|
||||
if (this.tabs.length > 0) {
|
||||
this.handleClick(0, this.tabs[0])
|
||||
} else {
|
||||
this.products = []
|
||||
}
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
@@ -112,7 +119,7 @@ export default{
|
||||
methods: {
|
||||
handleClick(index, tab) {
|
||||
this.activeIndex = index
|
||||
this.products = tab.products
|
||||
this.products = Array.isArray(tab && tab.products) ? tab.products : []
|
||||
},
|
||||
handleChange(e) {
|
||||
this.current = e.detail.current
|
||||
@@ -144,6 +151,17 @@ export default{
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.empty-wrap{
|
||||
min-height: 260rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.empty-text{
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
}
|
||||
.tab-line{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user