1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view class="uni-load-more" @click="onClick">
- <!-- #ifdef APP-NVUE -->
- <loading-indicator v-if="status === 'loading' && showIcon" :style="{color: color}" :animating="true"
- class="uni-load-more__img uni-load-more__img--nvue"></loading-indicator>
- <!-- #endif -->
- <!-- #ifdef APP-NVUE || H5 -->
- <text class="uni-load-more__text"
- :style="{color: color}">{{ status === 'more' ? contentText.contentdown : status === 'loading' ? contentText.contentrefresh : contentText.contentnomore }}</text>
- <!-- #endif -->
- </view>
- </template>
- <script>
- const platform = uni.getSystemInfoSync().platform
- export default {
- name: 'UniLoadMore',
- props: {
- status: {
- // 上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
- type: String,
- default: 'more'
- },
- showIcon: {
- type: Boolean,
- default: true
- },
- iconType: {
- type: String,
- default: 'auto'
- },
- color: {
- type: String,
- default: '#777777'
- },
- contentText: {
- type: Object,
- default () {
- return {
- contentdown: '上拉显示更多',
- contentrefresh: '正在加载...',
- contentnomore: '没有更多数据了'
- }
- }
- }
- },
- data() {
- return {
- platform: platform
- }
- },
- methods: {
- onClick() {
- this.$emit('clickLoadMore', {
- detail: {
- status: this.status,
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .uni-load-more {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex-direction: row;
- height: 40px;
- align-items: center;
- justify-content: center;
- }
- .uni-load-more__text {
- font-size: 15px;
- }
- .uni-load-more__img {
- width: 24px;
- height: 24px;
- margin-right: 8px;
- }
- .uni-load-more__img--nvue {
- color: #666666;
- }
- .uni-load-more__img--android,
- .uni-load-more__img--ios {
- width: 24px;
- height: 24px;
- transform: rotate(0deg);
- }
- </style>
|