zhaolinlau/nuxt-vscode-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHubNuxt VersionVue Version

Boost your Nuxt development with useful snippets that speed up your workflow. This extension includes snippets for Nuxt 3, Vue 3, and Pinia, making it easier and faster to write common code.

I took my inspiration from the vue-vscode-snippets extension by @sdras, the vue3-vscode-snippets extension by @ExEr7um, and the Vue-3-Code-Snippets extension by @okriiza.

  • Nuxt 3 snippets
  • Vue 3 snippets
  • Pinia snippets
  • Composition API snippets
  • Support for JavaScript and TypeScript
  • Visual Studio Code 1.75 or higher
  1. Open Extensions sidebar panel in VS Code. View → Extensions
  2. Search for Nuxt VS Code Snippets by zhaolinlau.
  3. Click Install to install it.

Type part of a snippet, press enter, and the snippet unfolds.

PrefixPurpose
npage<NuxtPage>
nlayout<NuxtLayout>
nlinkNuxt router link
nlink-paramNuxt router link with param
PrefixPurpose
nfetchuseFetch composable
nfetch-lazyuseLazyFetch composable
ndfetch$fetch
ndfetch-post$fetch with method POST and Body
ndfetch-put$fetch with method PUT and Body
ndfetch-delete$fetch with method DELETE and Body
nasyncdatauseAsyncData composable
nasyncdata-lazyuseLazyAsyncData composable
nreqheadersuseRequestHeaders composable
nreqfetchuseRequestFetch composable
ndatauseNuxtData composable
nrfshdatarefreshNuxtData utility
nclrdataclearNuxtData utility
nheaduseHead composable
nhead-descriptionuseHead composable with description
nhead-templateuseHead composable with title template
npagemetadefinePageMeta composable
npagemeta-descriptiondefinePageMeta composable with description
npagemeta-layoutdefinePageMeta composable with layout
npagemeta-middlewaredefinePageMeta composable with middleware
npagemeta-mldefinePageMeta composable with middleware layout
npluginBase code for Nuxt plugin
nmiddlewareBase code for Nuxt middleware
nserverBase code for Nuxt server
nerruseError composable
ncerrcreateError utility
nshwerrshowError utility
nclrerrclearError utility
nrouteuseRoute composable
nrouteruseRouter composable
nmoduleBase code for Nuxt module
PrefixPurpose
vbaseBase for Vue 3 File with <script setup> No style
vbase-scssBase for Vue 3 File with <script setup> Style SCSS
vbase-sassBase for Vue 3 File with <script setup> Style SASS
vbase-lessBase for Vue 3 File with <script setup> Style LESS
vbase-pcssBase for Vue 3 File with <script setup> Style PostCSS
vbase-cssBase for Vue 3 File with <script setup> Style CSS
vbase-tsBase for Vue 3 File with <script setup lang='ts'>, No Style
vbase-ts-scssBase for Vue 3 File with <script setup lang='ts'>, Style SCSS
vbase-ts-sassBase for Vue 3 File with <script setup lang='ts'>, Style SASS
vbase-ts-lessBase for Vue 3 File with <script setup lang='ts'>, Style LESS
vbase-ts-pcssBase for Vue 3 File with <script setup lang='ts'>, Style PostCSS
vbase-ts-cssBase for Vue 3 File with <script setup lang='ts'>, Style CSS
vscript<script setup>
vscript-ts<script setup lang='ts'>
vtemplate<template></template>
vforv-for statement
vslot-named<template #name></template>
PrefixPurpose
vtrans<Transition>
vtransgroup<TransitionGroup>
vkeepalive<KeepAlive>
vtp<Teleport>
vsuspense<Suspense>
PrefixPurpose
vrefVue ref
vreactiveVue reactive
vcomputedVue computed
vwatchWatcher
vwatcheffectWatch Effect
vonmountedonMounted hook
vonbeforemountonBeforeMount hook
vonbeforeupdateonBeforeUpdate hook
vonupdatedonUpdated hook
vonerrorcapturedonErrorCaptured hook
vonunmountedonUnmounted hook
vonbeforeunmountonBeforeUnmount hook
vdefinepropsDefine props
vdefineemitsDefine emits
vsingleemitSingle emit for defineEmits
vdefineslotsDefine slots
vsingleslotSingle slot for defineSlots
vdefineoptionsDefine Options
vdefinemodelDefine Model
PrefixPurpose
vrouterVue Router base
vscrollbehaviorVue Router scrollBehavior
vbeforeeachVue Router global guards beforeEach
vbeforeresolveVue Router global guards beforeResolve
vaftereachVue Router global guards afterEach
vbeforeenterVue Router per-route guard beforeEnter
vbeforerouteenterVue Router component guards beforeRouteEnter
vbeforerouteupdateVue Router component guards beforeRouteUpdate
vbeforerouteleaveVue Router component guards beforeRouteLeave
PrefixPurpose
pbaseBase code needed for a Pinia store file
pbase-cBase code needed for a Pinia store file with Composition API

This is an open source project open to anyone. Contributions are welcome

If you are contributing a snippet, please be sure to add the documentation for it in the tables in the README, the pull request cannot be accepted without this addition. Thanks!

MIT

Copyright © 2025-Present Zhaolin Lau