Skip to content

Empty data when accessing by key #836

@TCMAD

Description

@TCMAD

I try to access in specify location with my RTBD on a monofile component but I have some strange results when I use the key k .

Vue.use(Vuefire.rtdbPlugin)

const database = firebase.database();
const k = sessionStorage.getItem("keyEx");

export default {
    data : function(){
        return {
            key : k,
            exercice : []
        }
    },
    firebase : {
        exercice : database.ref('exercices/').child(k)
    }
}

Here is my template

<template>
    <p>
        {{ key || 'No key' }} <br>
        {{  exercice }} 
    </p>
</template>

And the result :
image

I don't understand why my objects are empty. If I try to use childKey, it will just print an empty array.
But if I just define : firebase : { exercice : database.ref('exercices/') }

It will give me my data :
image

How can I access to my child objects with the key k ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions