-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpinia.code-snippets
38 lines (38 loc) · 1.18 KB
/
pinia.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
"Pinia Store Base": {
"prefix": "pstore",
"body": [
"import { defineStore, acceptHMRUpdate } from \"pinia\"",
"",
"export const use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store = defineStore(\"$TM_FILENAME_BASE\", {",
"\tstate: () => ({",
"\t\t$0",
"\t}),",
"\tgetters: {},",
"\tactions: {},",
"})",
"",
"if (import.meta.hot) {",
"\timport.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store, import.meta.hot))",
"}",
""
],
"description": "Base code needed for a Pinia store file"
},
"Pinia Store Base - Composition API": {
"prefix": "pstore-composition",
"body": [
"import { defineStore, acceptHMRUpdate } from \"pinia\"",
"",
"export const use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store = defineStore(\"$TM_FILENAME_BASE\", () => {",
"\t${0}",
"})",
"",
"if (import.meta.hot) {",
"\timport.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store, import.meta.hot))",
"}",
""
],
"description": "Base code needed for a Pinia store file with Composition API"
}
}