diff --git a/README.md b/README.md index f440a8f..9e48152 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,12 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set | `vstore-import` | Import vuex store into main.js | | `vstore2` | Updated Base for Vuex store | +### Pinia + +| Snippet | Purpose | +| --------------- | ------------------------------ | +| `v-pinia-store` | Base for Pinia store | + ### Vue Router | Snippet | Purpose | diff --git a/package.json b/package.json index c5d44d3..8c6d49f 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,10 @@ "language": "javascript", "path": "./snippets/vue-script-vuex.json" }, + { + "language": "javascript", + "path": "./snippets/vue-script-pinia.json" + }, { "language": "javascript", "path": "./snippets/vue-script-router.json" @@ -72,6 +76,10 @@ "language": "typescript", "path": "./snippets/vue-script-vuex.json" }, + { + "language": "typescript", + "path": "./snippets/vue-script-pinia.json" + }, { "language": "typescript", "path": "./snippets/vue-script-router.json" diff --git a/snippets/vue-script-pinia.json b/snippets/vue-script-pinia.json new file mode 100644 index 0000000..d3cd4f8 --- /dev/null +++ b/snippets/vue-script-pinia.json @@ -0,0 +1,24 @@ +{ + "Pinia Store Boilerplate": { + "prefix": "v-pinia-store", + "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" + } +} \ No newline at end of file