Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
How do I get database data using firebase/nuxtjs

I don't know how to get the data via

this.$fire.database

I've read the firebase docs but in firebase/nuxtJs different it becomes easier https://firebase.nuxtjs.org/

In firebase docs

import { getDatabase, ref, onValue} from "firebase/database";

const db = getDatabase();
const starCountRef = ref(db, 'posts/' + postId + '/starCount');
onValue(starCountRef, (snapshot) => {
  const data = snapshot.val();
  updateStarCount(postElement, data);
});


But when I call onValue, it doesn't find it

this.$fire.database.onValue()

nuxt.config.js file

  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    [
      '@nuxtjs/firebase',
      {
        config: {
          apiKey: "<private data>",
          authDomain: "<private data>",
          projectId: "<private data>",
          storageBucket: "<private data>",
          messagingSenderId: "<private data>",
          appId: "<private data>"
        },
        services: {
          auth: true, // Just as example. Can be any other service.
          database: {
            emulatorPort: 3000,
            emulatorHost: 'localhost',
          }
        },
      }
    ]
  ],
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Simply

this.$fire.database.ref('name').on("value", function(e) {
  console.log(e.val())
})

simple explanation :

ref("name")

in Realtime Database : enter image description here

Whenever the value is changed, the function will run

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda