Answer the question
In order to leave comments, you need to log in
How to solve error when connecting Firebase + vuejs (nuxtjs)?
I'm using nuxtjs for a new project and decided to insert the values, the template is this:
<template>
<div v-for="slide in slides">
<div>{{ slide.text }}</div>
<div>{{ slide.title }}</div>
</div>
</template>
import axios from 'axios'
export default {
async data () {
let { data } = await axios.get('https://ggproduction-f0b98.firebaseio.com/slides.json')
return { slides: data }
}
}
[Vue warn]: data functions should return an object: https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function
(found in <Projects> at C:\Users\user\Desktop\my-project\pages\projects.vue)
[Vue warn]: Property or method "slides" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in <Projects> at C:\Users\user\Desktop\my-project\pages\projects.vue)
Answer the question
In order to leave comments, you need to log in
in my example, it was necessary to change only async data... to async asyncData...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question