久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='6cYBS'></small><noframes id='6cYBS'>

      <bdo id='6cYBS'></bdo><ul id='6cYBS'></ul>
  1. <tfoot id='6cYBS'></tfoot>
    <i id='6cYBS'><tr id='6cYBS'><dt id='6cYBS'><q id='6cYBS'><span id='6cYBS'><b id='6cYBS'><form id='6cYBS'><ins id='6cYBS'></ins><ul id='6cYBS'></ul><sub id='6cYBS'></sub></form><legend id='6cYBS'></legend><bdo id='6cYBS'><pre id='6cYBS'><center id='6cYBS'></center></pre></bdo></b><th id='6cYBS'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6cYBS'><tfoot id='6cYBS'></tfoot><dl id='6cYBS'><fieldset id='6cYBS'></fieldset></dl></div>
    1. <legend id='6cYBS'><style id='6cYBS'><dir id='6cYBS'><q id='6cYBS'></q></dir></style></legend>

      加載圖像時(shí)顯示加載圖標(biāo)

      Display a Loading icon while images loads(加載圖像時(shí)顯示加載圖標(biāo))
        <bdo id='YEJPv'></bdo><ul id='YEJPv'></ul>
        <i id='YEJPv'><tr id='YEJPv'><dt id='YEJPv'><q id='YEJPv'><span id='YEJPv'><b id='YEJPv'><form id='YEJPv'><ins id='YEJPv'></ins><ul id='YEJPv'></ul><sub id='YEJPv'></sub></form><legend id='YEJPv'></legend><bdo id='YEJPv'><pre id='YEJPv'><center id='YEJPv'></center></pre></bdo></b><th id='YEJPv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YEJPv'><tfoot id='YEJPv'></tfoot><dl id='YEJPv'><fieldset id='YEJPv'></fieldset></dl></div>
        <tfoot id='YEJPv'></tfoot>

          <legend id='YEJPv'><style id='YEJPv'><dir id='YEJPv'><q id='YEJPv'></q></dir></style></legend>

          <small id='YEJPv'></small><noframes id='YEJPv'>

              <tbody id='YEJPv'></tbody>
                本文介紹了加載圖像時(shí)顯示加載圖標(biāo)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                問(wèn)題描述

                我想在 div 中顯示一個(gè)背景圖像/加載微調(diào)器,它將在其中加載一個(gè)圖像,圖像將在完全加載后顯示,執(zhí)行如下操作:

                I want to show a background image/loading spinner inside a div that will load an image inside of it, the image will show once it's fully loaded doing something like this:

                   <div style="background-image:url('imageThatWillAppearBeforeLoad')"></div>
                

                演示(在 jQuery 中)

                如何使用 Angular2/Ionic2 獲得相同的效果?

                How can I have the same using Angular2/Ionic2?

                推薦答案

                創(chuàng)建一個(gè)組件,在加載請(qǐng)求的圖像之前顯示占位符圖像,并隱藏請(qǐng)求的圖像.加載圖像后,隱藏占位符并顯示圖像.

                Create a component that shows the placeholder image until the requested image is loaded, and hides the requested image. Once the image is loaded, you hide the placeholder and show the image.

                @Component({
                  selector: 'image-loader',
                  template: `<img *ngIf="!loaded" src="url-to-your-placeholder"/>
                    <img [hidden]="!loaded" (load)="loaded = true" [src]="src"/>`
                })
                export class ImageLoader {
                  @Input() src;
                }
                

                查看它在 Plunker 中的工作.

                See it working in Plunker.

                更新

                現(xiàn)在我更好地理解了要求,這里有一個(gè)帶有背景圖片的解決方案.有點(diǎn)hacky,我更喜歡原來(lái)的...

                Now that I understand the requirements better, here's a solution with background image. It's a little hacky, and I like the original one better...

                @Directive({
                  selector: '[imageLoader]'
                })
                export class ImageLoader {
                  @Input() imageLoader;
                
                  constructor(private el:ElementRef) {
                    this.el = el.nativeElement;
                    this.el.style.backgroundImage = "url(http://smallenvelop.com/demo/image-loading/spinner.gif)";
                  }
                
                  ngOnInit() {
                    let image = new Image();
                    image.addEventListener('load', () => {
                      this.el.style.backgroundImage = `url(${this.imageLoader})`;
                    });
                    image.src = this.imageLoader;
                  }
                }
                

                更新插件.

                這篇關(guān)于加載圖像時(shí)顯示加載圖標(biāo)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項(xiàng)目中不起作用)
                Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數(shù)據(jù)更新 Observable)
                Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動(dòng)態(tài)元素 - Angular 2 amp;離子2)
                <tfoot id='H0E0g'></tfoot>

                <small id='H0E0g'></small><noframes id='H0E0g'>

                <i id='H0E0g'><tr id='H0E0g'><dt id='H0E0g'><q id='H0E0g'><span id='H0E0g'><b id='H0E0g'><form id='H0E0g'><ins id='H0E0g'></ins><ul id='H0E0g'></ul><sub id='H0E0g'></sub></form><legend id='H0E0g'></legend><bdo id='H0E0g'><pre id='H0E0g'><center id='H0E0g'></center></pre></bdo></b><th id='H0E0g'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='H0E0g'><tfoot id='H0E0g'></tfoot><dl id='H0E0g'><fieldset id='H0E0g'></fieldset></dl></div>
                      <bdo id='H0E0g'></bdo><ul id='H0E0g'></ul>

                        1. <legend id='H0E0g'><style id='H0E0g'><dir id='H0E0g'><q id='H0E0g'></q></dir></style></legend>
                            <tbody id='H0E0g'></tbody>
                        2. 主站蜘蛛池模板: 久久精品视频国产 | 国产伦精品一区二区三区视频我 | 色婷婷导航 | 国产区免费 | 91在线看片 | 在线不欧美 | 天天爱夜夜操 | 欧美一级淫片免费视频黄 | 成人免费视频国产免费麻豆 | 亚洲欧美综合另类 | 日韩国产一区二区 | 国产一级在线 | 伊人精品在线 | 亚洲精品黄 | 欧美久久久久久久 | 亚洲精品www久久久久久广东 | 免费福利在线观看 | 成人黄性视频 | 国产在线视频一区二区 | 中文字幕免费在线观看 | 91一区二区三区 | 日韩在线视频一区 | av网站免费观看 | 亚洲成人免费观看 | 99久热| 一级大片免费看 | 一区二区三区在线观看视频 | 天天爽夜夜爽夜夜爽 | 欧美另类视频 | 亚洲第一免费视频 | 五月婷婷色综合 | 亚洲视频在线视频 | 亚洲午夜18毛片在线看 | 五月天一区二区 | av香蕉| 午夜免费网站 | 日韩精品福利 | 日韩免费一区二区 | 色婷婷久久久 | 狠狠五月 | 国产一级黄色录像 |