Code Monkey home page Code Monkey logo

vue-3-code-snippets's Introduction

Vue 3 Code Snippets for Visual Studio Code

GitHub Vue Version

Description

A VSCode extension to provide snippets for Vue 3, Nuxt 3 and Pinia.

I took my inspiration from vue-vscode-snippets extension made by @sdras.

I took my inspiration from vue3-vscode-snippets extension made by @ExEr7um.

Features

  • Vue 3 snippets
  • Nuxt 3 snippets
  • Pinia snippets
  • Composition API snippets
  • Support for JavaScript and TypeScript

Requirements

  • Visual Studio Code 1.75 or higher

Installation

  1. Open Extensions sidebar panel in VS Code. View โ†’ Extensions
  2. Search for Vue 3 Code Snippets by RendiOkriza.
  3. Click Install to install it.

Usage

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

Snippets

Support File .vue

Prefix Purpose
vstart start for Vue 3 File with <script setup> No style
vstart-scss start for Vue 3 File with <script setup> Style SCSS
vstart-sass start for Vue 3 File with <script setup> Style SASS
vstart-less start for Vue 3 File with <script setup> Style LESS
vstart-pcss start for Vue 3 File with <script setup> Style PostCSS
vstart-css start for Vue 3 File with <script setup> Style CSS
vstart-ts start for Vue 3 File with <script setup lang='ts'>, No Style
vstart-ts-scss start for Vue 3 File with <script setup lang='ts'>, Style SCSS
vstart-ts-sass start for Vue 3 File with <script setup lang='ts'>, Style SASS
vstart-ts-less start for Vue 3 File with <script setup lang='ts'>, Style LESS
vstart-ts-pcss start for Vue 3 File with <script setup lang='ts'>, Style PostCSS
vstart-ts-css start for Vue 3 File with <script setup lang='ts'>, Style CSS
Prefix Purpose
vscript <script setup>
vscript-ts <script setup lang='ts'>
vtemplate <template></template>
vfor v-for statement
vslot-named <template #name></template>
  • Nuxt
Prefix Purpose
nlink Nuxt router link
nlink-param Nuxt router link with param

Support File .js, .ts

  • Vue Router
Prefix Purpose
vrouter Vue Router start
vscrollbehavior Vue Router scrollBehavior
vbeforeeach Vue Router global guards beforeEach
vbeforeresolve Vue Router global guards beforeResolve
vaftereach Vue Router global guards afterEach
vbeforeenter Vue Router per-route guard beforeEnter
vbeforerouteenter Vue Router component guards beforeRouteEnter
vbeforerouteupdate Vue Router component guards beforeRouteUpdate
vbeforerouteleave Vue Router component guards beforeRouteLeave
  • Pinia
Prefix Purpose
pstart Start code needed for a Pinia store file
pstart-c Start code needed for a Pinia store file with Composition API

Support File .vue, .js, .ts

  • Vue
Prefix Purpose
vref Vue ref
vreactive Vue reactive
vcomputed Vue computed
vwatch Watcher
vwatcheffect Watch Effect
vonmounted onMounted hook
vonbeforemount onBeforeMount hook
vonbeforeupdate onBeforeUpdate hook
vonupdated onUpdated hook
vonerrorcaptured onErrorCaptured hook
vonunmounted onUnmounted hook
vonbeforeunmount onBeforeUnmount hook
vdefineprops Define props
vdefineemits Define emits
vsingleemit Single emit for defineEmits
vdefineslots Define slots
vsingleslot Single slot for defineSlots
vdefineoptions Define Options
vdefinemodel Define Model
  • Nuxt
Prefix Purpose
nfetch useFetch composable
nfetch-lazy useLazyFetch 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
nasyncdata useAsyncData composable
nasyncdata-lazy useLazyAsyncData composable
nhead useHead composable
nhead-description useHead composable with description
nhead-template useHead composable with title template
npagemeta definePageMeta composable
npagemeta-description definePageMeta composable with description
npagemeta-layout definePageMeta composable with layout
npagemeta-middleware definePageMeta composable with middleware
npagemeta-ml definePageMeta composable with middleware layout
nplugin Start code for Nuxt plugin
nmiddleware Start code for Nuxt middleware
nserver Start code for Nuxt server

License

MIT ยฉ Rendi Okriza Putra

Enjoy!

vue-3-code-snippets's People

Contributors

okriiza avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.