Browse Source

解决推荐瀑布流bug

test
Enzo 5 years ago
parent
commit
aebc38ee9c
  1. 23
      components/lf-waterfall-recom/lf-waterfall.vue
  2. 2
      pages/discover/discover.vue
  3. 8
      pages/index/index.vue
  4. 12
      pages/recommList/index.vue

23
components/lf-waterfall-recom/lf-waterfall.vue

@ -49,21 +49,19 @@
}, },
data(){ data(){
return { return {
} }
}, },
computed: { computed: {
dataList() {
console.log('数据1111',this.list);
let arr = [];
if(this.list && this.list.length){
arr = this.list;
}
return arr;
}
dataList: {
// let arr = [];
// if(this.list && this.list.length){
// arr = this.list;
// }
// return arr;
get() { return this.list; },
set(newValue) { console.log('newvalue',newValue) }
},
}, },
onShow(){ onShow(){
@ -73,7 +71,6 @@
}, },
methods: { methods: {
onClick(id){ onClick(id){
console.log("aaaa");
this.$url('/pages/goodsDetail/index?goods_id='+id); this.$url('/pages/goodsDetail/index?goods_id='+id);
this.$emit('click'); this.$emit('click');
}, },

2
pages/discover/discover.vue

@ -6,7 +6,7 @@
<image :src="item.big.image" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image> <image :src="item.big.image" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image>
</view> </view>
<view class="flex-direction bg-white discover-radius"> <view class="flex-direction bg-white discover-radius">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="(i,index) of item.children" @click="$url('/pages/notice/article?article_id='+i.id)">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="(i,index) of item.children" :key="index" @click="$url('/pages/notice/article?article_id='+i.id)">
<view> <view>
<image :src="i.image" mode="aspectFill" style="width: 100rpx;height: 100rpx;"></image> <image :src="i.image" mode="aspectFill" style="width: 100rpx;height: 100rpx;"></image>
</view> </view>

8
pages/index/index.vue

@ -1,13 +1,13 @@
<template> <template>
<view> <view>
<swiper class="head" :current="banner_current" > <swiper class="head" :current="banner_current" >
<swiper-item @click="clickBanner" v-for="(item,index) of banner">
<swiper-item @click="clickBanner" v-for="(item,index) of banner" :key="index">
<image :src="item.url" class="swipe-img" mode="aspectFill"></image> <image :src="item.url" class="swipe-img" mode="aspectFill"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="content"> <view class="content">
<!-- 消息模块 --> <!-- 消息模块 -->
<view class="lf-row-between lf-m-b-34 message-box" v-for="(item,index) of notice">
<view class="lf-row-between lf-m-b-34 message-box" v-for="(item,index) of notice" :key="index">
<view class="lf-flex"> <view class="lf-flex">
<text class="lf-iconfont lf-icon-tongzhi lf-text-vertical"></text> <text class="lf-iconfont lf-icon-tongzhi lf-text-vertical"></text>
<view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">{{item.title}}</view> <view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">{{item.title}}</view>
@ -23,7 +23,7 @@
</view> </view>
</view> </view>
<view class="lf-flex-wrap"> <view class="lf-flex-wrap">
<view class="channel-item" v-for="(item, index) in channel_list" @click="$url('/pages/goodsList/index?channel_id='+item.id)">
<view class="channel-item" v-for="(item, index) in channel_list" :key="index" @click="$url('/pages/goodsList/index?channel_id='+item.id)">
<image :src="item.icon" class="channel-mask" mode="aspectFill"></image> <image :src="item.icon" class="channel-mask" mode="aspectFill"></image>
<view class="lf-row-center channe-text lf-font-bold">{{item.name}}</view> <view class="lf-row-center channe-text lf-font-bold">{{item.name}}</view>
<!-- <view> <!-- <view>
@ -68,7 +68,7 @@
</view> </view>
</view> </view>
<view class="lf-row-between lf-m-t-10"> <view class="lf-row-between lf-m-t-10">
<view class="recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)" v-for="(item,index) of hot_list" v-if="index>2">
<view class="recomm-img" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)" :key="index" v-for="(item,index) of hot_list" v-if="index>2">
<image :src="item.product.picture" class="lf-w-100 lf-h-100"></image> <image :src="item.product.picture" class="lf-w-100 lf-h-100"></image>
</view> </view>
</view> </view>

12
pages/recommList/index.vue

@ -39,6 +39,9 @@
this.windowHeight = getApp().globalData.windowHeight; this.windowHeight = getApp().globalData.windowHeight;
this.getCategory() this.getCategory()
}, },
onHide() {
this.$refs.uWaterfall[this.current].clear();
},
methods: { methods: {
getCategory(options = {}) { getCategory(options = {}) {
this.$http(this.API.API_CATEGORYLIST).then(res => { this.$http(this.API.API_CATEGORYLIST).then(res => {
@ -76,15 +79,10 @@
tab_item.loadingClass = false; tab_item.loadingClass = false;
tab_item.loadingText = '没有更多数据啦~'; tab_item.loadingText = '没有更多数据啦~';
} }
console.log('page',tab_item.page)
if(tab_item.page == 1){ if(tab_item.page == 1){
console.log('zhix1')
tab_item.list = res.data.data; tab_item.list = res.data.data;
console.log('zhix1数据',tab_item.list)
}else{ }else{
console.log('zhix2')
tab_item.list.push(...res.data.data); tab_item.list.push(...res.data.data);
console.log('zhix2数据',tab_item.list)
} }
}).catch(err => { }).catch(err => {
@ -92,8 +90,8 @@
}, },
tabChange(index){ tabChange(index){
this.$refs.uWaterfall[index].clear(); this.$refs.uWaterfall[index].clear();
this.tab_list = []
this.getCategory({type: 'pageRefresh'});
this.tab_list[index].list = [];
// this.getCategory({type: 'pageRefresh'});
console.log(this.$refs) console.log(this.$refs)
this.current = index; this.current = index;
if(this.tab_list[index].list.length <= 0){ if(this.tab_list[index].list.length <= 0){

Loading…
Cancel
Save