Skip to content

Instantly share code, notes, and snippets.

@kazuooooo
Created February 5, 2022 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuooooo/18c34827f64440295d33b2f1af4a1ddb to your computer and use it in GitHub Desktop.
Save kazuooooo/18c34827f64440295d33b2f1af4a1ddb to your computer and use it in GitHub Desktop.
sample1.ts
export const useExampleStore = defineStore('expamle', {
state: {/*...*/}
actions: {
async setup() {
// ...
//🌟 docDataとdocRefを同期
onSnapshot(docRef, (ds) => {
if (ds.exists()) {
this.$patch({ docData: ds.data() })
}
})
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment