Polymer preload spinner

前端 未结 1 924
独厮守ぢ
独厮守ぢ 2020-12-31 17:43

Sometimes it takes a while for polymer to load, and when using , the page stays blank until everything is ready. Is there a way to displa

1条回答
  •  不思量自难忘°
    2020-12-31 18:10

    The documentation that describes the unresolved attribute clears some of this up.

    While it's common to apply unresolved to the element, causing the entirety of your page's content to be hidden until Polymer is ready, it can be applied to any element(s). You can, for instance, use

    as a wrapper around the portion of your page that relies on Polymer, and create a loading message that's outside that wrapper which will be visible immediately. (You'd then want to listen to the polymer-ready event and hide your loading message when that's fired.)

    Here's an example using a very contrived way of slowing down the time it takes for the Polymer element to complete one of its lifecycle methods (live demo):

    
    
      
        
        Polymer Demo
        
      
      
        

    Loading...

    Here I am... finally! Me too!

    (By the way, what are you finding to be slow-loading? If it's a standard/core element, it might be worth filing a bug against the corresponding project on GitHub.)

    0 讨论(0)
提交回复
热议问题