小程序自定义实现loading,小程序,站长入门,新手站长网
  • 首页
  • 站长入门
    • 外贸建站
    • WooCommerce
    • 建站入门
    • 域名知识
    • 编程代码
    • 工具资源
    • 网站优化
    • 数据库
    • 服务器
    • 小程序
    • 电商
    • 编程英语
  • Cms文章
    • wordpress
    • pbootcms
    • zblog
    • 易优
    • 帝国cms
    • 迅睿
  • PB 教程
    • 新手入门教程
    • Pbootcms文章
    • 用户使用手册
    • 常见问题解答
    • pbootcms小程序
  • 应用市场
  • 笔记分享
    • 网络安全
    • 自媒体
    • 抖音
    • 快手
    • 其他
    • 手机技巧
  • 会员中心
首页 > 站长入门 > 小程序 >

小程序自定义实现loading

2022-10-29 发布在 小程序0

<loading>{{正在加载...}}</loading> //内容也是可自定义的

效果图:




二、代码实现:

1.loading 组件的view实<!-- loading开始 -->








 
<em id="__mceDel">      <view class="loading" wx:if="{{loadingFlag}}">        <view class="loading_mask"></view>
        <view class="weui-loadmore">
          <view class="weui-loading"></view>
          <text class="weui-loadmore__tips">正在加载</text>
        </view>
     </view>
       <!-- loading结束 --><br><br>调用的页面组件实现:<br> 配置:</em>


      {"usingComponents": {"com-loading":"../component/comLoading/loading"}}
   调用的页面调用:(可以自定义加载时的文字显示)
     <com-loading pro-content="正在加载"></com-loading>

2.组件js:

properties: {
    proContent:{
      type:String,
      value:"正在加载..."
    },
  },

3.css样式




































 
/* loading样式开始 */
.loading{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.loading_mask{
  position: absolute;
  width: 45%;
  margin: 14em 22.5%;
  height: 2.6em;
  border-radius: 20rpx;
  background: #000;
  opacity: .5;
}
.weui-loadmore {
  position: absolute;
  width: 45%;
  margin: 16em 22.5%;
  line-height: 2.6em;
  font-size: 14px;
  color: #fff;
  text-align: center;
}
.weui-icon_toast.weui-loading{
  margin:30px 0 0;
  width:38px;
  height:38px;
  vertical-align:baseline;
}
.weui-loading{
    width:20px;
    height:20px;
    display:inline-block;
    vertical-align:middle;
    -webkit-animation:weuiLoading 1s steps(12, end) infinite;
    animation:weuiLoading 1s steps(12, end) infinite;
    background:transparent url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E") no-repeat;
    background-size:100%;
  }
  .weui-loading.weui-loading_transparent,
  .weui-btn_loading.weui-btn_primary .weui-loading,
  .weui-btn_loading.weui-btn_warn .weui-loading{
    background-image:url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E");
  }
  @-webkit-keyframes weuiLoading{
    0%{
    -webkit-transform:rotate3d(0, 0, 1, 0deg);
        transform:rotate3d(0, 0, 1, 0deg);
    }
    100%{
    -webkit-transform:rotate3d(0, 0, 1, 360deg);
        transform:rotate3d(0, 0, 1, 360deg);
    }
  }
  @keyframes weuiLoading{
    0%{
    -webkit-transform:rotate3d(0, 0, 1, 0deg);
        transform:rotate3d(0, 0, 1, 0deg);
    }
    100%{
    -webkit-transform:rotate3d(0, 0, 1, 360deg);
        transform:rotate3d(0, 0, 1, 360deg);
    }
  }
.weui-loadmore__tips {
  display: inline-block;
  vertical-align: middle;
  color: rgba(0,0,0,0.9);
  color: var(--weui-FG-0);
}

如果您的问题还未解决可以联系站长付费协助。 加入我们

有问题可以加入技术QQ群一起交流学习
本站vip会员 请加入无忧模板网 VIP群(50604020) PS:加入时备注用户名或昵称
普通注册会员或访客 请加入无忧模板网 技术交流群(50604130)
客服微信号:15898888535
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若内容侵犯了原著者的合法权益,可联系站长删除。

内容 代码 实现 加载 定义 lt 程序 gt loading 组件
赏
上一篇 小程序布局方式
下一篇 微信小程序swiper轮播图片自适应高度

相关文章

  • 泰安SEO内容页优化的关键步骤;泰安seo内容页优化的关键步骤
  • SEO优化员工的工作内容及技巧(seo优化专员工作的内容有哪些)
  • SEO深度优化平台广告分析:助你实现网站流量暴涨
  • 三水网络推广专家,助您实现SEO优化的目标
  • seo内容优化帮你火21星热情(seo资讯引流拓客)
  • SEO优化任务:提升网站排名,实现更高流量与曝光

热门

  • 1 微信小程序中使用HTTPS调用自带文本安全内容检测接口 踩坑
  • 2 微信小程序+php 对接获取access token实例
  • 3 微信小程序 对接php代码例子
  • 4 微信小程序复制文字功能详解

应用市场

  • ¥100 采集文章自动推送百度插件 PHP插件支持推送百度当天文章

    ¥100 采集文章自动推送百度插件 PHP插件支持推送百度当天文章

    2023-07-03

  • ¥50 pbootcms副栏目多选功能 默认只能多选一个 此插件可多选多个栏目

    ¥50 pbootcms副栏目多选功能 默认只能多选一个 此插件可多选多个栏目

    2023-07-03

  • ¥100  根据标题生成图片,文章页自动配标题配图,避免版权问题,所有cms通用php

    ¥100 根据标题生成图片,文章页自动配标题配图,避免版权问题,所有cms通用php

    2023-07-03

  • ¥300 pbootcms插件 附件阿里云OSS直传适合大文件视频类

    ¥300 pbootcms插件 附件阿里云OSS直传适合大文件视频类

    2023-07-03

热门标签

置顶   发短   撤销   时光   Centos8   长度   发多   基础库   Helvetica   找到   NET   投资   有关   db   客户机   HP   SEOer   创建   播放量   消费者   工具栏   卫生纸   专业版   nova8   申诉   低调   Neue   首先   业务   暴富   历程   stripos   马木马   USB   苦恼   网址   博主   产品   文档   爆单  
  • 站长入门
  • Cms文章
  • PB 教程
  • 应用市场
  • 笔记分享
  • 会员中心
  • XML地图

Copyright © 2018-2020 新手站长网 All Rights Reserved.
免责声明:本站所有资源(模板、图片、字体等)搜集整理于互联网或者网友提供,仅供学习与交流使用,如果不小心侵犯到你的权益,请及时联系我们删除该资源,邮箱mcuv#qq.com。 鲁ICP备2021016954号-3 网站模板

实用工具

觉得文章有用就打赏一下吧

微信扫一扫打赏