-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add pinia snippets #4 Snippets list: - pstore Co-authored-by: Daniel Kelly <me@danielkelly.io>
- Loading branch information
1 parent
765a428
commit afad595
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"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" | ||
} | ||
} |