Skip to content

Commit fb4e1f0

Browse files
committed
feat: Add Pinia composition store snippets (#29)
Pinia composition API snippet #26
1 parent 9c7b7c2 commit fb4e1f0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: snippets/pinia.code-snippets

+16
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,21 @@
1818
""
1919
],
2020
"description": "Base code needed for a Pinia store file"
21+
},
22+
"Pinia Store Base - Composition API": {
23+
"prefix": "pstore-composition",
24+
"body": [
25+
"import { defineStore, acceptHMRUpdate } from \"pinia\"",
26+
"",
27+
"export const use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store = defineStore(\"$TM_FILENAME_BASE\", () => {",
28+
"\t${0}",
29+
"})",
30+
"",
31+
"if (import.meta.hot) {",
32+
"\timport.meta.hot.accept(acceptHMRUpdate(use${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}Store, import.meta.hot))",
33+
"}",
34+
""
35+
],
36+
"description": "Base code needed for a Pinia store file with Composition API"
2137
}
2238
}

0 commit comments

Comments
 (0)