【问题标题】:Ionic loading on full page instead of small box离子加载整页而不是小盒子
【发布时间】:2019-05-24 21:38:58
【问题描述】:

此时我可以使用这种简单的loading 效果。但它显示为一个小盒子。

presentLoadingText() {
  let loading = this.loadingCtrl.create({
     content: 'Loading Please Wait...'
  });

  loading.present();    

}

但我有一个任务是像这样创建整页加载器。

它应该是整页,背景为黑色,外观像上面一样透明。不需要那种波浪效应。有什么线索吗?

【问题讨论】:

    标签: html css angular ionic-framework ionic3


    【解决方案1】:

    这对我来说是可行的解决方案。我的目标是loading-wrapper

    app.scss

    .loading-wrapper {
        position: absolute !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        display: -webkit-box;
        display: -moz-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -moz-box-pack: center;
        -webkit-justify-content: center;
        -ms-flex-pack: center;
        justify-content: center;
        -webkit-align-content: stretch;
        -ms-flex-line-pack: stretch;
        align-content: stretch;
        -webkit-box-align: center;
        -moz-box-align: center;
        -webkit-align-items: center;
        -ms-flex-align: center;
        align-items: center;
        min-width: 100% !important;
        max-height: 100% !important;
        background-color: rgba(0, 0, 0, 0.8) !important;
    }
    

    .ts

     let loader = this.loadingCtrl.create({
          content:
            `<div class="custom-spinner-container">
            Please wait...
          </div>`,
        });
        loader.present();
    

    用户界面:

    【讨论】:

      【解决方案2】:

      我已经有了,所以你可以在 css 的帮助下做到这一点。

      html

      this.loading = this.loadingCtrl.create({
          spinner: 'spinner',
          content: `
          <div class="login_view">
              <div class="loader_view">
                  <div class="cst_loader"></div>
              </div>
          </div>`,
          showBackdrop: showBackdrop
      });
      this.loading.present();
      

      ts

      .login_view{
          background: url(../../assets/imgs/login_bg.png) no-repeat 100% 100%;
          background-size: contain;
      }
      .loader_view{
          position: absolute;
          left: 50%;
          top: 50%;
          transform: translate(-50%, -50%);
      }
      

      【讨论】:

      • 我们不能用透明背景(css)代替图片吗?
      • 我认为您可以使用它,只需删除背景图像并检查,因为在我的情况下,我有图像。
      • 我曾经这样使用过.login_view { background-color: rgba(0, 0, 0, 0.5) !important; }。但它不起作用。有什么线索吗?
      • 我认为你必须给高度和宽度 100% 100%
      • 那也行不通。我可以看到这些样式已应用于开发工具。但是没有效果。你能分享你的屏幕图像吗?图片也不适合我?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-22
      • 1970-01-01
      • 1970-01-01
      • 2020-03-09
      • 1970-01-01
      • 2019-05-23
      • 2015-07-27
      相关资源
      最近更新 更多