引入

  1. {
  2. "usingComponents": {
  3. "x-loading":"waft-ui/assembly/loading/loading"
  4. }
  5. }

代码示例

  1. <x-loading text="加载中" loading="{{ loading3 }}" vertical="{{ true }}" size="{{ 80 }}" full="{{ true }}"></x-loading>

效果展示

loading.png

组件样式

html

  1. <view class="loading">
  2. <!-- <view class="title">横向 loading</view> -->
  3. <x-nav-bar showArrow="{{true}}" title="测试 loading 组件"></x-nav-bar>
  4. <view class="content">
  5. <view style="height: 100rpx;"> </view>
  6. <x-loading text="加载中" loading="{{ loading1 }}"></x-loading>
  7. <!-- <view class="title">垂直 loading</view> -->
  8. <view style="height: 100rpx;"> </view>
  9. <x-loading text="加载中" loading="{{ loading2 }}" vertical="{{ true }}" size="{{ 60 }}"></x-loading>
  10. <!-- <view class="btn" onClick="loading">点击开启全屏 loading</view> -->
  11. <x-loading text="加载中" loading="{{ loading3 }}" vertical="{{ true }}" size="{{ 80 }}" full="{{ true }}"></x-loading>
  12. </view>
  13. </view>

css

  1. .title {
  2. font-size: 26rpx;
  3. color: #2b3852;
  4. font-weight: bold;
  5. }
  6. .btn {
  7. padding: 10rpx 20rpx;
  8. border-radius: 6rpx;
  9. background-color: #00b3ff;
  10. color: #E6F2FF;
  11. }
  12. .loading{
  13. width: 100%;
  14. height: 100%;
  15. display: flex;
  16. justify-content:flex-start;
  17. align-items: center;
  18. flex-direction: column;
  19. background-color: #F0F2F7;
  20. }
  21. .content{
  22. flex: 1;
  23. display: flex;
  24. flex-direction: column;
  25. justify-content:flex-start;
  26. align-items: center;
  27. }

API

  • props | 参数 | 说明 | 类型 | 默认值 | | —- | —- | —- | —- | | loading | 是否 loading 状态 | boolean | false | | full | 是否全屏 loading | boolean | false | | size | loading 图标大小 | number | 30 | | text | loading 文字 | string | | | textSize | loading 文字大小 | number | 22 | | textColor | loading 文字颜色 | string | #7383a2 | | vertical | 是否垂直排列文案 | boolean | false |