[Vuejs]-Having to explicitly remove '.key' before setting/updating data in Firebase

2👍

As an alternative you could use firebase directly instead of vuefire.

methods: {
  show: function() {
    var form = this;
    form.isShown = true;
    fb.ref(`/widgets/${form.firebaseKey}`)
      .on('value')
      .then(snapshot => {
        form.firebaseData = snapshot.val();
      });
  },
  save: function() {
    var form = this;

    fb.ref(`/widgets/${form.firebaseKey}`).set(form.firebaseData, function(err) {
      if (err) form.error = err;
    });
  }
}

Leave a comment