Skip to content

Instantly share code, notes, and snippets.

@TheDutchCoder
Last active October 7, 2020 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheDutchCoder/57ce0ac52558596446a441e98c3b35a1 to your computer and use it in GitHub Desktop.
Save TheDutchCoder/57ce0ac52558596446a441e98c3b35a1 to your computer and use it in GitHub Desktop.
VSCode snippets for Vue components
{
"component": {
"prefix": "component",
"body": [
"<template>",
"\t<div>${9}</div>",
"<\/template>",
"",
"<script>",
"export default {",
"\tname: '${1:ComponentName}',",
"\t",
"\tcomponents: {${2}},",
"\t",
"\tprops: {${3}},",
"\t",
"\tdata: () => ({",
"\t\t${4}",
"\t}),",
"\t",
"\tcomputed: {${5}},",
"\t",
"\tcreated () {${6}},",
"\t",
"\tmounted () {${7}},",
"\t",
"\tmethods: {${8}},",
"}",
"</script>",
],
"description": "Vue component template"
},
"renderless": {
"prefix": "renderless",
"body": [
"<script>",
"export default {",
"\tname: '${1:ComponentName}',",
"\t",
"\trender: function (createElement) {",
"\t\treturn createElement(",
"\t\t\t'${2:div}',",
"\t\t\t{",
"\t\t\t\tclass: [${3}],",
"\t\t\t\t",
"\t\t\t\tstyle: [${4}],",
"\t\t\t\t",
"\t\t\t\tattrs: {${5}},",
"\t\t\t\t",
"\t\t\t\tprops: {${6}},",
"\t\t\t\t",
"\t\t\t\tdomProps: {${7}},",
"\t\t\t\t",
"\t\t\t\ton: {${8}},",
"\t\t\t\t",
"\t\t\t\tnativeOn: {${9}},",
"\t\t\t\t",
"\t\t\t\tdirectives: [${10}],",
"\t\t\t\t",
"\t\t\t\tscopedSlots: {${11}},",
"\t\t\t\t",
"\t\t\t\tslot: '${12}',",
"\t\t\t\t",
"\t\t\t\tkey: '${13}',",
"\t\t\t\t",
"\t\t\t\tref: '${14}',",
"\t\t\t\t",
"\t\t\t\trefInFor: ${15:true},",
"\t\t\t},",
"\t\t\tthis.\\$slots.default",
"\t\t)",
"\t},",
"}",
"</script>",
],
"description": "Vue renderless component template"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment