Skip to content

Instantly share code, notes, and snippets.

@morsecodemedia
Created July 11, 2019 03:03
Show Gist options
  • Save morsecodemedia/eaeeb3e74b55fbd1e23cac24ec8274f0 to your computer and use it in GitHub Desktop.
Save morsecodemedia/eaeeb3e74b55fbd1e23cac24ec8274f0 to your computer and use it in GitHub Desktop.
A VS Code Snippet for a Nuxt.js SFC Boilerplate
{
"Nuxt SFC Boilerplate": {
"prefix": "nsfc",
"body": [
"<template>",
"<div>",
"<!-- Because you need a single node in template -->",
"</div>",
"</template>",
"<script>",
"export default {",
"name: 'ComponentNameOfChoice',",
"components: {},",
"props: {",
"propNameOfChoice: {",
"type: Object,",
"required: true,",
"twoWay: true,",
"default: () => {}",
"}",
"},",
"data() {",
"return {",
"message: 'Hello World!'",
"}",
"},",
"watch: {",
"watchFunctionNameOfChoice: function (newSlide, oldSlide) {",
"console.log('watcher watchFunctionNameOfChoice')",
"}",
"},",
"computed: {",
"computedFunctionNameOfChoice() {",
"console.log('computed computedFunctionNameOfChoice')",
"}",
"},",
"methods: {",
"methodsFunctionNameOfChoice: function() {",
"console.log('methods methodsFunctionNameOfChoice ... redundant much?')",
"}",
"},",
"beforeCreate: function() {",
"console.log('befreCreate')",
"},",
"created: function() {",
"console.log('created')",
"},",
"beforeMount: function() {",
"console.log('beforeMount')",
"},",
"mounted: function() {",
"console.log('mounted')",
"},",
"beforeUpdate: function() {",
"console.log('beforeUpdate')",
"},",
"updated: function() {",
"console.log('updated')",
"},",
"beforeDestroy: function() {",
"console.log('beforeDestroy')",
"},",
"destroyed: function() {",
"console.log('destroyed')",
"}",
"}",
"</script>",
"<style lang='scss' scoped>",
"</style>"
],
"description": "Creates a SFC boilerplate for Nuxt that includes all lifecycle hooks and other misc things."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment