You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/getting-started.md
+27-2Lines changed: 27 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ VueFire requires Firebase JS SDK >= 9 but **is compatible with Vue 2 and Vue 3**
20
20
21
21
## Usage
22
22
23
-
VueFire expects you to use the existing APIs from Firebase as much as possible. It doesn't expose any configs to initialize your app or get the database/firestore instances. You should follow the official Firebase documentation for that. We do have [some recommendations](#TODO) for a Vue project and [a Nuxt module](#TODO) to help you get started.
23
+
VueFire expects you to use the existing APIs from Firebase as much as possible. It doesn't expose any configs to initialize your app or get the database/firestore instances. You should follow the official Firebase documentation for that. We do have [some recommendations](#TODO) for a Vue project and [a Nuxt module](../cookbook/nuxt.md) to help you get started.
24
24
25
25
Most of the time, you should gather collection references in one of your files and export them but **to keep examples short, we will always create the database references whenever necessary** instead of gathering them in one place. We will also consider that we have access to some globals (you usually import them from the file where you initialize your Firebase app):
26
26
@@ -30,7 +30,7 @@ import { getFirestore } from 'firebase/firestore'
Note that we will refer to `database` and `firestore` as `db` in examples where only one of them is used.
43
43
:::
44
44
45
+
### Setup
46
+
47
+
First, install the VueFire Vue plugin. It will allow you to add extra modules like [Storage](./storage.md) or [Auth](./auth.md) to your app.
48
+
49
+
```ts
50
+
import { createApp } from'vue'
51
+
import { VueFire, VueFireAuth } from'vuefire'
52
+
importAppfrom'./App.vue'
53
+
// the file we created above with `database`, `firestore` and other exports
54
+
import { firebaseApp } from'./firebase'
55
+
56
+
const app =createApp(App)
57
+
app
58
+
.use(VueFire, {
59
+
// imported above but could also just be created here
60
+
firebaseApp,
61
+
modules: [
62
+
// we will see other modules later on
63
+
VueFireAuth(),
64
+
],
65
+
})
66
+
67
+
app.mount('#app')
68
+
```
69
+
45
70
### Composition API
46
71
47
72
VueFire exposes a few [composables](https://vuejs.org/guide/reusability/composables.html#composables) to create reactive variables from Firebase references.
0 commit comments