Last active
September 9, 2021 15:50
-
-
Save d8vjork/5e090bdc6a2f01d39f3bc2812f0fad79 to your computer and use it in GitHub Desktop.
Vue 3 + JS + TS (Composition API & Setup RFC only) VS Code snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"setup defineProps": { | |
"prefix": "sprops", | |
"body": [ | |
"${1:const props = }defineProps({", | |
"\t${2:${3:prop}: ${4:type},}", | |
"});" | |
], | |
"description": "Create setup defineProps block" | |
}, | |
"Component full prop": { | |
"prefix": "prop", | |
"body": [ | |
"${1:propName}: ${2:{", | |
"\t${3:type: ${4:String},}", | |
"\t${5:required: ${6:false},}", | |
"\t${7:default: ${8:\"\"},}", | |
"\t${9:validation: (value) => {", | |
"\t\t${10}", | |
"\t\\},}", | |
"\\}}," | |
], | |
"description": "Create full prop definition" | |
}, | |
"Component prop": { | |
"prefix": "sprop", | |
"body": [ | |
"${1:propName}: ${2:Boolean},", | |
], | |
"description": "Create simple prop definition" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"typescript setup defineProps": { | |
"prefix": "tssprops", | |
"body": [ | |
"interface Props {", | |
"\t${1key: type}", | |
"}", | |
"", | |
"${2:const props = }defineProps<Props>();" | |
], | |
"description": "Create setup typed defineProps block" | |
}, | |
"typescript setup defineProps withDefaults": { | |
"prefix": "tsdefprops", | |
"body": [ | |
"interface Props {", | |
"\t${1:${2:key}: ${3:type}}", | |
"}", | |
"", | |
"${4:const props = }withDefaults(defineProps<Props>(), {", | |
"\t${5:${2:key}: ${6:value}},", | |
"});" | |
], | |
"description": "Create setup typed defineProps block withDefaults" | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"setup defineProps": { | |
"prefix": "sprops", | |
"body": [ | |
"${1:const props = }defineProps({", | |
"\t${2:${3:prop}: ${4:type}},", | |
"});" | |
], | |
"description": "Create setup defineProps block" | |
}, | |
"Component full prop": { | |
"prefix": "prop", | |
"body": [ | |
"${1:propName}: ${2:{", | |
"\t${3:type: ${4:String}},", | |
"\t${5:required: ${6:false}},", | |
"\t${7:default: ${8:\"\"}},", | |
"\t${9:validation: (value) => {", | |
"\t\t${10}", | |
"\t\\},}", | |
"\\}}," | |
], | |
"description": "Create full prop definition" | |
}, | |
"Component prop": { | |
"prefix": "sprop", | |
"body": [ | |
"${1:propName}: ${2:Boolean},", | |
], | |
"description": "Create simple prop definition" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment