123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <view
- class="u-loadmore"
- :style="[
- $u.addStyle(customStyle),
- {
- backgroundColor: bgColor,
- marginBottom: $u.addUnit(marginBottom),
- marginTop: $u.addUnit(marginTop),
- height: $u.addUnit(height),
- },
- ]"
- >
- <u-line
- length="140rpx"
- :color="lineColor"
- :hairline="false"
- :dashed="dashed"
- v-if="line"
- ></u-line>
-
- <view
- :class="status == 'loadmore' || status == 'nomore' ? 'u-more' : ''"
- class="u-loadmore__content"
- >
- <view
- class="u-loadmore__content__icon-wrap"
- v-if="status === 'loading' && icon"
- >
- <u-loading-icon
- :color="iconColor"
- :size="iconSize"
- :mode="loadingIcon"
- ></u-loading-icon>
- </view>
-
- <text
- class="u-line-1"
- :style="[loadTextStyle]"
- :class="[(status == 'nomore' && isDot == true) ? 'u-loadmore__content__dot-text' : 'u-loadmore__content__text']"
- @tap="loadMore"
- >{{ showText }}</text>
- </view>
- <u-line
- length="140rpx"
- :color="lineColor"
- :hairline="false"
- :dashed="dashed"
- v-if="line"
- ></u-line>
- </view>
- </template>
- <script>
- import props from './props.js';
-
- export default {
- name: "u-loadmore",
- mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
- data() {
- return {
-
- dotText: "●"
- }
- },
- computed: {
-
- loadTextStyle() {
- return {
- color: this.color,
- fontSize: uni.$u.addUnit(this.fontSize),
- lineHeight: uni.$u.addUnit(this.fontSize),
- backgroundColor: this.bgColor,
- }
- },
-
- showText() {
- let text = '';
- if (this.status == 'loadmore') text = this.loadmoreText
- else if (this.status == 'loading') text = this.loadingText
- else if (this.status == 'nomore' && this.isDot) text = this.dotText;
- else text = this.nomoreText;
- return text;
- }
- },
- methods: {
- loadMore() {
-
- if (this.status == 'loadmore') this.$emit('loadmore');
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/components.scss";
- .u-loadmore {
- @include flex(row);
- align-items: center;
- justify-content: center;
- flex: 1;
- &__content {
- margin: 0 15px;
- @include flex(row);
- align-items: center;
- justify-content: center;
- &__icon-wrap {
- margin-right: 8px;
- }
- &__text {
- font-size: 14px;
- color: $u-content-color;
- }
- &__dot-text {
- font-size: 15px;
- color: $u-tips-color;
- }
- }
- }
- </style>
|