¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <u-transition |
| | | :show="loading" |
| | | :custom-style="{ |
| | | position: 'fixed', |
| | | top: 0, |
| | | left: 0, |
| | | right: 0, |
| | | bottom: 0, |
| | | backgroundColor: bgColor, |
| | | display: 'flex', |
| | | }" |
| | | > |
| | | <view class="u-loading-page"> |
| | | <view class="u-loading-page__warpper"> |
| | | <view class="u-loading-page__warpper__loading-icon"> |
| | | <image |
| | | v-if="image" |
| | | :src="image" |
| | | class="u-loading-page__warpper__loading-icon__img" |
| | | mode="widthFit" |
| | | :style="{ |
| | | width: $u.addUnit(iconSize), |
| | | height: $u.addUnit(iconSize) |
| | | }" |
| | | ></image> |
| | | <u-loading-icon |
| | | v-else |
| | | :mode="loadingMode" |
| | | :size="$u.addUnit(iconSize)" |
| | | :color="loadingColor" |
| | | ></u-loading-icon> |
| | | </view> |
| | | <slot> |
| | | <text |
| | | class="u-loading-page__warpper__text" |
| | | :style="{ |
| | | fontSize: $u.addUnit(fontSize), |
| | | color: color, |
| | | }" |
| | | >{{ loadingText }}</text |
| | | > |
| | | </slot> |
| | | </view> |
| | | </view> |
| | | </u-transition> |
| | | </template> |
| | | |
| | | <script> |
| | | import props from "./props.js"; |
| | | /** |
| | | * loadingPage å è½½å¨ç» |
| | | * @description è¦æ¤ç»ä»¶ä¸ºä¸ä¸ªå°å¨ç»ï¼ç®åç¨å¨uViewçloadmoreå è½½æ´å¤åswitchå¼å
³çç»ä»¶çæ£å¨å è½½ç¶æåºæ¯ã |
| | | * @tutorial https://www.uviewui.com/components/loading.html |
| | | * @property {String | Number} loadingText æç¤ºå
容 (é»è®¤ 'æ£å¨å è½½' ) |
| | | * @property {String} image æå䏿¹ç¨äºæ¿æ¢loadingå¨ç»çå¾ç |
| | | * @property {String} loadingMode å è½½å¨ç»ç模å¼ï¼circle-åå½¢ï¼spinner-è±æµå½¢ï¼semicircle-ååå½¢ ï¼é»è®¤ 'circle' ï¼ |
| | | * @property {Boolean} loading æ¯å¦å è½½ä¸ ï¼é»è®¤ false ï¼ |
| | | * @property {String} bgColor èæ¯è² ï¼é»è®¤ '#ffffff' ï¼ |
| | | * @property {String} color æåé¢è² ï¼é»è®¤ '#C8C8C8' ï¼ |
| | | * @property {String | Number} fontSize æåå¤§å° ï¼é»è®¤ 19 ï¼ |
| | | * @property {String | Number} iconSize 徿 å¤§å° ï¼é»è®¤ 28 ï¼ |
| | | * @property {String} loadingColor å è½½ä¸å¾æ çé¢è²ï¼åªè½rgbæè
åå
è¿å¶é¢è²å¼ ï¼é»è®¤ '#C8C8C8' ï¼ |
| | | * @property {Object} customStyle èªå®ä¹æ ·å¼ |
| | | * @example <u-loading mode="circle"></u-loading> |
| | | */ |
| | | export default { |
| | | name: "u-loading-page", |
| | | mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
| | | data() { |
| | | return {}; |
| | | }, |
| | | methods: {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import "../../libs/css/components.scss"; |
| | | |
| | | $text-color: rgb(200, 200, 200) !default; |
| | | $text-size: 19px !default; |
| | | $u-loading-icon-margin-bottom: 10px !default; |
| | | |
| | | .u-loading-page { |
| | | @include flex(column); |
| | | flex: 1; |
| | | align-items: center; |
| | | justify-content: center; |
| | | |
| | | &__warpper { |
| | | margin-top: -150px; |
| | | justify-content: center; |
| | | align-items: center; |
| | | /* #ifndef APP-NVUE */ |
| | | color: $text-color; |
| | | font-size: $text-size; |
| | | /* #endif */ |
| | | @include flex(column); |
| | | |
| | | &__loading-icon { |
| | | margin-bottom: $u-loading-icon-margin-bottom; |
| | | |
| | | &__img { |
| | | width: 40px; |
| | | height: 40px; |
| | | } |
| | | } |
| | | |
| | | &__text { |
| | | font-size: $text-size; |
| | | color: $text-color; |
| | | } |
| | | } |
| | | } |
| | | </style> |