Last active
October 2, 2024 09:38
-
-
Save danielkellyio/d82bd6c803e3ec04e498b38cccf63981 to your computer and use it in GitHub Desktop.
VS Code Snippet for Defining Pinia Stores
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
{ | |
"Pinia Store Boilerplate": { | |
"prefix": "pinia", | |
"body": [ | |
"import { defineStore, acceptHMRUpdate } from \"pinia\";", | |
"", | |
"export const use$TM_FILENAME_BASE = defineStore(\"$TM_FILENAME_BASE\", {", | |
" state: () => {", | |
" return {", | |
" $0", | |
" };", | |
" },", | |
" getters: {},", | |
" actions: {},", | |
"});", | |
"", | |
"if (import.meta.hot) {", | |
" import.meta.hot.accept(acceptHMRUpdate(use$TM_FILENAME_BASE, import.meta.hot));", | |
"}", | |
"" | |
], | |
"description": "Bootstrap the code needed for a Vue.js Pinia store file" | |
} | |
} |
the use of this plugin https://marketplace.visualstudio.com/items?itemName=wenfangdu.snippet-generator can be helpful... :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions for Use