列表瀑布流插件清空问题

version/0412
syt 9 months ago
parent 792fc6c7b3
commit 00012f2e07
  1. 36
      pages/goods/list.vue
  2. 16
      pages/invite/index.vue

@ -177,7 +177,7 @@
</template> </template>
</u-waterfall> </u-waterfall>
</view> </view>
<!-- <u-empty text="暂无数据显示哦~" v-if="list.data.length==0" mode="list"></u-empty> --> <u-empty text="暂无数据显示哦~" v-if="list.data.length==0 && total == 0" mode="list"></u-empty>
</view> </view>
</mescroll-body> </mescroll-body>
</view> </view>
@ -202,7 +202,8 @@
}, },
mixins: [MescrollMixin, WxofficialMixin], mixins: [MescrollMixin, WxofficialMixin],
data() { data() {
return { return {
total: 1,
searchText: '', searchText: '',
banrdType: [], banrdType: [],
keyName1: '', keyName1: '',
@ -286,7 +287,8 @@
this.keyName2 = item.name this.keyName2 = item.name
} }
} }
this.list.data = []
this.$refs.uWaterfall1.clear();
this.getGoodsList() this.getGoodsList()
}, },
/** /**
@ -310,7 +312,16 @@
setShowView() { setShowView() {
this.showView = uni.getStorageSync(showViewKey) || false this.showView = uni.getStorageSync(showViewKey) || false
}, },
//
arrayUnique(arr, name) {
    var hash = {};
    return arr.reduce(function (item, next) {
        hash[next[name]]
            ? ""
            : (hash[next[name]] = true && item.push(next));
        return item;
    }, []);
},
/** /**
* 获取商品列表 * 获取商品列表
* @param {number} pageNo 页码 * @param {number} pageNo 页码
@ -337,8 +348,17 @@
GoodsApi.list(param) GoodsApi.list(param)
.then(result => { .then(result => {
// //
const newList = result.data.list const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo) console.log(newList)
let arr = getMoreListData(newList, app.list, pageNo);
console.log("arr",arr)
app.list.data = app.arrayUnique(arr,'goods_id')
app.total = result.data.list.total;
console.log("app.total",app.total)
console.log("app.list.data",app.list.data)
// console.log("app.list.data",app.list.data)
// console.log("newList",newList)
resolve(newList) resolve(newList)
}) })
.catch(reject) .catch(reject)
@ -350,7 +370,9 @@
const app = this const app = this
const newSortPrice = newSortType === 'price' ? !app.sortPrice : true const newSortPrice = newSortType === 'price' ? !app.sortPrice : true
app.sortType = newSortType app.sortType = newSortType
app.sortPrice = newSortPrice app.sortPrice = newSortPrice
app.$refs.uWaterfall1.clear();
app.list.data = []
// //
app.list = getEmptyPaginateObj() app.list = getEmptyPaginateObj()
app.mescroll.resetUpScroll() app.mescroll.resetUpScroll()

@ -286,7 +286,7 @@
left: 50%; left: 50%;
margin-left: -336rpx; margin-left: -336rpx;
top: 50%; top: 50%;
margin-top: -456rpx; margin-top: -556rpx;
z-index: 2; z-index: 2;
.bg { .bg {
@ -307,15 +307,19 @@
} }
.tips { .tips {
width: 100%; width: 600rpx;
height: 30rpx; height: 80rpx;
position: absolute; position: absolute;
text-align: center; text-align: center;
font-size: 30rpx; font-size: 30rpx;
color: #FFFFFF; line-height: 80rpx;
left: 0; border-radius: 10rpx;
bottom: -50rpx; color: #212121;
left: 50%;
margin-left: -300rpx;
bottom: -120rpx;
z-index: 2; z-index: 2;
background-color: #FFFFFF;
} }
.close { .close {

Loading…
Cancel
Save