久久久久久久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ì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我想在 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,我更喜歡原來的...

                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)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(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. 主站蜘蛛池模板: 久久国产日本 | 伊人网综合在线观看 | 亚洲最新在线视频 | 精品视频免费 | 熟女毛片 | 色偷偷人人澡人人爽人人模 | 国产日韩视频 | 国产99精品 | 成人午夜精品 | 在线看av网址 | 国产女人与拘做视频免费 | 久久蜜桃av | 成人 在线 | 国产乱码精品一区二区三区忘忧草 | 午夜精品久久久久久久星辰影院 | 久久久精 | 精品一区在线 | 亚洲欧美综合精品久久成人 | 亚洲色欲色欲www | 免费国产一区二区 | 在线播放国产一区二区三区 | 国产精品片aa在线观看 | 国产伦精品一区二区三区四区视频 | 国产一区二区日韩 | 欧美精品1区 | 男人的天堂中文字幕 | 综合九九 | 国产精品久久久久久妇女 | 欧美国产精品一区二区三区 | 狠狠操婷婷 | 九九在线精品视频 | 国产成在线观看免费视频 | 97超碰人人| 国产中文 | 久久精品欧美电影 | 91啪亚洲精品 | 综合网视频 | 伊人手机在线视频 | 国产精品91久久久久久 | 成人久久 | 一区二区视频 |