Browse Source

[优化] 首页没有tabs的情况,提示

twodate
邓平艺 4 years ago
parent
commit
6caa56808c
  1. 81
      pages/index/index.vue

81
pages/index/index.vue

@ -1,48 +1,53 @@
<template> <template>
<view class="lf-row-center lf-flex-column"> <view class="lf-row-center lf-flex-column">
<view class="ctab" v-if="tab_list.length">
<u-tabs :list="tab_list" :is-scroll="true" :show-bar="false" :current="current" @change="change"></u-tabs>
</view>
<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}" :current="current" @change="swiperChange">
<swiper-item v-for="(tab, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
<view class="lf-row-between list" v-for="(item, index) in tab.list" :key="item.id" @click="toDetail(item)">
<view class="left">
<image :src="item.cover" mode="aspectFill"></image>
</view>
<view class="right">
<view class="lf-line-2 title">{{ item.name }}</view>
<view class="lf-flex tips">
<view class="lf-row-between lf-flex-1" v-if="item.specs[0]">
<view class="lf-flex">
<view class="u-line-progress" v-if="item.specs[0].sold_percent">
<u-line-progress :percent="item.specs[0].sold_percent" height="20" :striped="true" active-color="#FE9903" :show-percent="false" inactive-color="#F5F5F5"></u-line-progress>
<block v-if="tab_list.length">
<view class="ctab">
<u-tabs :list="tab_list" :is-scroll="true" :show-bar="false" :current="current" @change="change"></u-tabs>
</view>
<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}" :current="current" @change="swiperChange">
<swiper-item v-for="(tab, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
<view class="lf-row-between list" v-for="(item, index) in tab.list" :key="item.id" @click="toDetail(item)">
<view class="left">
<image :src="item.cover" mode="aspectFill"></image>
</view>
<view class="right">
<view class="lf-line-2 title">{{ item.name }}</view>
<view class="lf-flex tips">
<view class="lf-row-between lf-flex-1" v-if="item.specs[0]">
<view class="lf-flex">
<view class="u-line-progress" v-if="item.specs[0].sold_percent">
<u-line-progress :percent="item.specs[0].sold_percent" height="20" :striped="true" active-color="#FE9903" :show-percent="false" inactive-color="#F5F5F5"></u-line-progress>
</view>
<text class="progress lf-m-r-10">{{ item.specs[0].sold_percent_text }}</text>
</view>
<view>
<text class="bought">{{ item.specs[0].sold_stock_text }}</text>
</view> </view>
<text class="progress lf-m-r-10">{{ item.specs[0].sold_percent_text }}</text>
</view>
<view>
<text class="bought">{{ item.specs[0].sold_stock_text }}</text>
</view> </view>
</view> </view>
<view class="lf-row-between price">
<lf-price :price="item.specs[0].selling_price" v-if="item.specs[0]"></lf-price>
<text class="lf-font-24 original-price" v-if="item.specs[0]">{{ item.specs[0].original_price }}</text>
<text v-else></text>
<button>立即抢购</button>
</view>
</view> </view>
<view class="lf-row-between price">
<lf-price :price="item.specs[0].selling_price" v-if="item.specs[0]"></lf-price>
<text class="lf-font-24 original-price" v-if="item.specs[0]">{{ item.specs[0].original_price }}</text>
<text v-else></text>
<button>立即抢购</button>
</view>
</view> </view>
</view>
<!-- 空数据的情况 -->
<view class="loading-more">
<text v-if="tab.list.length" :class="{'loading-more-text': tab.loadingClass}">{{ tab.loadingText }}</text>
<my-nocontent v-else></my-nocontent>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</scroll-view>
</swiper-item>
</swiper>
<!-- 空数据的情况 -->
<view class="loading-more">
<text v-if="tab.list.length" :class="{'loading-more-text': tab.loadingClass}">{{ tab.loadingText }}</text>
<my-nocontent v-else></my-nocontent>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</scroll-view>
</swiper-item>
</swiper>
</block>
<block v-else>
<my-nocontent></my-nocontent>
</block>
</view> </view>
</template> </template>

Loading…
Cancel
Save