firebase - How can I make vuefire show loading screen? -


as title vuefire can auto data firebase database, needs loading time. want display css animation before data being fetched, there event can $watch when successed

you can multiple ways. vuefire has readycallback out of box callback called when data fetched (ready).

here is:

var vm = new vue({   el: '#demo',   data: function() {     return {        loaded: false     }   }   firebase: {     // simple syntax, bind array default     anarray: db.ref('url/to/my/collection'),     // can bind query     // anarray: db.ref('url/to/my/collection').limittolast(25)     // full syntax     anobject: {       source: db.ref('url/to/my/object'),       // optionally bind object       asobject: true,       // optionally provide cancelcallback       cancelcallback: function () {},       // called once data has been retrieved firebase       readycallback: function () {          this.loaded = true // note line       }     }   } }) 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -