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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -