dingdong-mall/components/custom-bar/load-status-bar.vue

54 lines
1.1 KiB
Vue
Raw Normal View History

2022-05-26 20:24:33 +08:00
<template>
<view>
2022-06-25 17:31:17 +08:00
<view class="margin-bottom-lg margin-top-sm">
2023-08-06 22:45:13 +08:00
<view v-if="hasMoreData" class="text-center bg-main-color padding-tb text-lg" @click="reqMoreData">
2022-05-26 20:24:33 +08:00
<text class="margin-right-xs">查看更多</text>
<text class="text-bold cuIcon-unfold"></text>
</view>
<view class="cu-load" :class="loadMoreStatus"></view>
</view>
</view>
</template>
<script>
export default {
name: 'load-status-bar',
2022-06-17 16:44:35 +08:00
emits: ['loadMore'],
2022-05-26 20:24:33 +08:00
data() {
return {
loadMoreStatus: '',
hasMoreData: true
}
},
methods: {
showLoading() {
2023-08-06 22:45:13 +08:00
this.loadMoreStatus = 'loading bg-main-color padding-tb text-lg';
2022-05-26 20:24:33 +08:00
this.hasMoreData = false;
},
showLoadMore() {
this.loadMoreStatus = '';
this.hasMoreData = true;
},
showLoadOver() {
2023-08-06 22:45:13 +08:00
this.loadMoreStatus = 'over bg-grey padding-tb text-lg';
2022-05-26 20:24:33 +08:00
this.hasMoreData = false;
},
showLoadErr() {
2023-08-06 22:45:13 +08:00
this.loadMoreStatus = 'erro bg-red padding-tb text-lg';
2022-05-26 20:24:33 +08:00
this.hasMoreData = false;
2022-06-17 16:44:35 +08:00
},
reqMoreData() {
this.$emit('loadMore')
2022-05-26 20:24:33 +08:00
}
},
}
</script>
2023-08-06 22:45:13 +08:00
<style scoped>
.cu-load {
display: block;
line-height: unset;
text-align: center;
}
2022-05-26 20:24:33 +08:00
</style>