Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
Cómo acceder a firebase realtimedb en NUXT js

Tenemos un realtimedb en firebase que tiene datos de la siguiente manera:

ingrese la descripción de la imagen aquí

En nuestra página nuxt tenemos el siguiente método:

 async getDb () { const messageRef = this.$firebase.database.ref('test') try { const snapshot = await messageRef.once('value') alert(snapshot.val().message) } catch (e) { alert(e) } },

Eso es ejecutado por esto en montado así:

 mounted () { this.getDb() },

Sigo recibiendo este error:

No capturado (en promesa) TypeError: no se pueden leer las propiedades de undefined (leyendo 'base de datos')

¿Estoy haciendo algo mal? Tengo toda la configuración de firebase en Nuxt.config.js y suth funciona bien. También agregué realtimedb a los servicios:

 services: { realtimeDb: true, auth: { ssr: true, // it is recommended to configure either a mutation or action but you can set both initialize: { onAuthStateChangedMutation: 'ON_AUTH_STATE_CHANGED_MUTATION' // onAuthStateChangedAction: 'onAuthStateChangedAction' } },

¿Cómo accede realmente a los datos de realtimedb para que pueda mostrar la matriz de prueba en mi página?

over 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está utilizando $firebase que no está incluido en esta documentación . Para otorgar acceso a su base de datos en tiempo real, use lo siguiente:

 $fire.database

o

 $fireModule.database

Nota:

Si está utilizando la versión 6 de nuxt/firebase , use realtimeDb y la base de database para la versión 7 en los servicios de nuxt.config.js , consulte este enlace para obtener más detalles.

over 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Virtual assistant