[Vuejs]-How do I render data from Firebase in vue at page load

0๐Ÿ‘

    <div id="main">
        <div id="cardFront">{{preRenderedData}}</div>        
    </div>  
</template>
<script>
    module.exports = {
        data () {
            return {
                preRenderedData: null,
                fbData:[],
        }
    },
    created() {
        var ref = firebase.database().ref("Users/MK01111000/cards")
        ref.once("value")
        .then(function(snapshot) {
            this.fbData = snapshot.val()
        })          
    },
    beforeMount() {
       this.preRenderedData = this.fbData
    }
}

Leave a comment