优化商品搜索 空数据显示

master
lemon橪 2022-05-27 15:45:37 +08:00 committed by 学习很差啦
parent f90807ebc6
commit 3aa5b21d49
1 changed files with 17 additions and 14 deletions

View File

@ -129,18 +129,6 @@
<uni-load-more :status="loadingType" @loadmore="loadmore()"></uni-load-more> <uni-load-more :status="loadingType" @loadmore="loadmore()"></uni-load-more>
</scroll-view> </scroll-view>
</div> </div>
<div class="empty" v-if="goodsList == [] || goodsList == '' || goodsList == null">
<view>
<image style="width: 320rpx; height: 240rpx" src="/static/nodata.png">
</image>
</view>
<view>
<p>没有找到相关的商品信息</p>
<p>请换一个关键词试试吧</p>
</view>
</div>
<!-- 一行两个商品展示 --> <!-- 一行两个商品展示 -->
<div v-if=" <div v-if="
!isSWitch && !isSWitch &&
@ -272,6 +260,17 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<div class="empty" v-if="empty">
<view>
<image style="width: 320rpx; height: 240rpx" src="/static/nodata.png">
</image>
</view>
<view>
<p>没有找到相关的商品信息</p>
<p>请换一个关键词试试吧</p>
</view>
</div>
<u-back-top :scroll-top="scrollTop"></u-back-top> <u-back-top :scroll-top="scrollTop"></u-back-top>
</view> </view>
</template> </template>
@ -285,6 +284,7 @@ import storage from "@/utils/storage";
export default { export default {
data() { data() {
return { return {
empty:false,
scrollTop: 0, scrollTop: 0,
loadIndex: 10, loadIndex: 10,
oldKeywordIndex: "", oldKeywordIndex: "",
@ -714,6 +714,9 @@ export default {
if (goodsList.data.result.content.length < 10) { if (goodsList.data.result.content.length < 10) {
this.loadingType = "noMore"; this.loadingType = "noMore";
this.empty = true
} else {
this.empty = false
} }
this.goodsList.push(...goodsList.data.result.content); this.goodsList.push(...goodsList.data.result.content);
this.initSortGoods(); this.initSortGoods();