gdg-tangier / vue-firestore

:cloud: Cloud Firestore binding in realtime with Vuejs
MIT License
235 stars 28 forks source link

How to Integrate Vue-Firestore to Quasar-app Framework (VueJS) ? #9

Closed heliosnarcissus closed 6 years ago

heliosnarcissus commented 6 years ago

Hi I'm a newbie on quasar framework and would like to know if you have an idea how I can add this awesome vue-firestore library to my project folder? Working on web-app. :D

lopugit commented 6 years ago

have a look at app plugins

http://quasar-framework.org/guide/app-plugins.html

I do it like this:

` // /src/plugins/firestore.js // import something here import firebase from 'firebase' import '@firebase/firestore' var fs = initFirestore()

// leave the export, even if you don't use it export default ({ app, router, Vue }) => { var firebaseApp if(!firebase.apps.length){ firebaseApp = firebase.initializeApp(config) } else { firebaseApp = firebase.app() } }

function initFirestore(){ const config = { apiKey: "", authDomain: "", databaseURL: "", projectId: "", storageBucket: "", messagingSenderId: "" } const settings = { timestampsInSnapshots: true }

if(!firebase.apps.length){
    firebase.initializeApp(config)
} else {
    // F = firebase.app()
}
var fs = firebase.firestore() // firestore
fs.settings(settings)
fs.SetOptions = {merge: true}
return fs

}`

And then in quasar.conf.js you'll put the string 'firestore' into your plugins array

module.exports = function(ctx) { return { plugins: [] } }

DAMN 19 days!! Sorry no one replied! That's a shame :'( Go over to discord quasar

https://discordapp.com/channels/415874313728688138

There's heaps of active people there.

I don't even use the vue firestore wrapper but I might end up needing it.

amranidev commented 6 years ago

hello @heliosnarcissus, sorry for the delay.

  1. npm install vue-firestore --save
  2. Go to your-project/dev/main.js and import the vue-firestore plugin.
    
    ...
    import Firestore from 'vue-firestore'

Vue.use(Firestore) ...



Thanks!