微信小程序自定义Loading效果

  1. 效果图

在这里插入图片描述

  1. wxml
<view class="loading-model" hidden="{{uploadLoading}}">
    <view class="lm-box">
        <image class="loading" src="http://m.qpic.cn/psc?/V51tK08W01DHek2QrM9N1kWNPe31gfWz/TmEUgtj9EK6.7V8ajmQrEKlLPigUFQwzGFnVdE4rDKuk4a8HI1DBigyO*kJH50FqWJR4hwz31Tdc*ZXlK2B4LFvMO76TQieKtJmMvHB8*QU!/b&bo=gACAAIAAgAACGT0!&rf=viewer_4" mode="aspectFill" />
        <text class="loading-title">{{loadingTitle}}</text>
    </view>
</view>
  1. less
.loading-model {
    position: absolute;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    .lm-box {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 260rpx;
      height: 260rpx;
      border-radius: 16rpx;
      background-color: rgba(0, 0, 0, 0.7);
      position: absolute;
      top: 34%;
      left: calc(50% - 130rpx);
      .loading {
        width: 80rpx;
        height: 80rpx;
      }
      .loading-title{
        font-size: 28rpx;
        margin-top: 24rpx;
        color: rgba(255,255,255,0.8);
      }
    }
  }
  1. js
Page({
  data: {
    uploadLoading: true, //控制的loading样式显示与否
    loadingTitle: "保存中. . .", //loading的提示语
  },
});
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值