添加消息无数据提示

This commit is contained in:
ghusermoon 2020-08-24 15:13:38 +08:00
parent 6306573ee4
commit 0a5115b8f4
3 changed files with 45 additions and 13 deletions

View File

@ -15,6 +15,7 @@
</view> </view>
</view> </view>
</block> </block>
<u-loadmore :status="loadStatus" bg-color="#ECECEC" margin-top="20" v-if="loadStatus=='nomore'" />
</view> </view>
</template> </template>
@ -23,9 +24,8 @@
data() { data() {
return { return {
height:'600', height:'600',
actives: [ actives: [],
loadStatus: 'loadmore'
]
}; };
}, },
onLoad(){ onLoad(){
@ -45,7 +45,9 @@
messageactivityList(){ messageactivityList(){
this.$u.api.messageactivityList({}).then((res)=>{ this.$u.api.messageactivityList({}).then((res)=>{
if (res.errCode == 0) { if (res.errCode == 0) {
this.actives = res.data; this.actives = res.data;
// ,,
if(!this.actives.length) this.loadStatus = 'nomore';
} }
}) })
} }

View File

@ -18,6 +18,7 @@
</view> </view>
</view> </view>
</view> </view>
<u-loadmore :status="loadStatus" bg-color="#ECECEC" margin-top="20" @loadmore="loadmore" />
</view> </view>
</template> </template>
@ -26,20 +27,45 @@
data() { data() {
return { return {
actives: [], actives: [],
page: 1 page: 1,
timer: true,
loadStatus: 'loadmore'
}; };
}, },
onLoad() { onLoad() {
this.getCartList(); this.getCartList();
}, },
onReachBottom() {
this.loadmore();
},
methods: { methods: {
getCartList() { loadmore() {
this.$u.post("message/orderDeliveryList",{page: this.page}).then(res => { if(!this.timer) return false;
console.log(res.data.data) this.loadStatus = "loading";
if (res.errCode == 0) { this.page++;
this.actives = res.data.data; this.getCartList({ load: 'loadmore' }).then(length => {
} if(length == 0) {
}) this.page--;
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
},
async getCartList({ load = 'reload' } = {}) {
const res = await this.$u.post("message/orderDeliveryList",{ page: this.page })
this.timer = true;
if (res.errCode == 0) {
if(load == 'reload') {
this.actives = res.data.data;
if(res.data.data.length < 12) this.loadStatus = "nomore";
}
else if(load == 'loadmore') this.actives.push(...res.data.data);
}
return res.data.data.length;
}, },
viewLogistics(item) { viewLogistics(item) {
let url; let url;

View File

@ -2,6 +2,7 @@
<view id="viewes" :style="{height : height + 'px'}"> <view id="viewes" :style="{height : height + 'px'}">
<!-- 公告咨询 --> <!-- 公告咨询 -->
<notice :list="list"></notice> <notice :list="list"></notice>
<u-loadmore :status="loadStatus" bg-color="#ECECEC" margin-top="20" v-if="loadStatus=='nomore'" />
</view> </view>
</template> </template>
@ -11,6 +12,7 @@
data() { data() {
return { return {
list: [], list: [],
loadStatus: 'loadmore'
}; };
}, },
onLoad() { onLoad() {
@ -29,6 +31,8 @@
this.$u.api.informationList({}).then((res) => { this.$u.api.informationList({}).then((res) => {
if (res.errCode == 0) { if (res.errCode == 0) {
this.list = res.data; this.list = res.data;
// ,
if(!this.list.length) this.loadStatus = 'nomore';
} }
}) })
} }