Primero mi saludos a usted Sr. Fazt
requiero de ayuda en cuanto a la solución para poder eliminar objeto en firebase esto haciendo énfasis en su ejercicio.
Estos son los errores cuando intento eliminar el objeto.
vue.esm.js?efeb:628 [Vue warn]: Error in v-on handler: "Error: Reference.child failed: First argument was an invalid path = "undefined". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]""
y
Error: Reference.child failed: First argument was an invalid path = "undefined". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
at validatePathString (index.esm.js?66c8:1669)
at Reference.child (index.esm.js?66c8:13889)
at VueComponent.deleteWebsite (App.vue?26cd:108)
at click (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-7ba5bd90","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/App.vue
![image](https://user-images.githubusercontent.com/42816252/104753616-a1d2f000-572e-11eb-81bc-540a814a75fe.png)
acá el código:
{{web.name}}
{{web.author}}
Delete
<script>
import Firebase from 'firebase';
import config from './config';
let app = Firebase.initializeApp(config);
let db = app.database();
let websitesRef = db.ref('websites');
export default {
name: 'App',
firebase: {
websites:websitesRef
},
data() {
return {
websites:[],
newWebsite: {
name: '',
author: '',
url:''
}
}
},
created() {
Firebase.database().ref('websites').on('value', (snapshot) => {
this.websites = snapshot.val()
})
},
methods:{
addWebsite(){
websitesRef.push(this.newWebsite);
this.newWebsite.name='';
this.newWebsite.url='';
this.newWebsite.author='';
},
deleteWebsite(website){
websitesRef.child(website['.key']).remove()
}
}
}
</script>
Gracias