【发布时间】:2017-12-20 03:39:27
【问题描述】:
在使用 POST 方法时,有没有办法在 Firebase 中设置自定义 ID?类似:
{
"users": {
"user_one": {
"username": "jdoe",
"password": "123"
}
}
}
我正在开发一个 Vue.js 项目并试图拯救一些学生和他们的父母,例如:
let padre = {
nombre: this.padre.nombre,
apellido: this.padre.apellido,
cedula: this.padre.cedula,
nacionalidad: this.padre.nacionalidad,
estado_civil: this.padre.estado_civil,
instruccion: this.padre.instruccion,
profesion: this.padre.profesion,
trabaja: this.padre.trabaja,
l_trabajo: this.padre.l_trabajo,
d_trabajo: this.padre.d_trabajo,
tlf_trabajo: this.padre.tlf_trabajo,
tlf_habitacion: this.padre.tlf_habitacion,
tlf_movil: this.padre.tlf_movil
}
axios.post('https://projectname.firebaseio.com/padres.json', padre)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
【问题讨论】:
标签: javascript firebase firebase-realtime-database vue.js