Last active
December 9, 2021 16:11
-
-
Save johnleider/4bbab0a04495b0f0876dcba7d5d3f310 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"Import Vue": { | |
"prefix": "ivue", | |
"body": [ | |
"import { $1 } from 'vue'$0" | |
] | |
}, | |
"New TSX Component": { | |
"prefix": "bptsx", | |
"body": [ | |
"// Utility", | |
"import { defineComponent } from 'vue'", | |
"import { useRender } from '@/util'", | |
"", | |
"export const $1 = defineComponent({", | |
" name: '$1',", | |
"", | |
" props: {", | |
" //", | |
" },", | |
"", | |
" setup (props, { slots }) {", | |
" useRender(() => (", | |
" <div>", | |
" { slots?.default?.() }", | |
" </div>", | |
" ))", | |
"", | |
" return {}", | |
" },", | |
"})", | |
"", | |
] | |
}, | |
"New TSX Component w/ Slot": { | |
"prefix": "bptsxs", | |
"body": [ | |
"// Utility", | |
"import { genericComponent, useRender } from '@/util'", | |
"", | |
"// Types", | |
"import type { MakeSlots } from '@/util'", | |
"", | |
"export const $1 = genericComponent<new <T>() => {", | |
" $$slots: MakeSlots<{", | |
" default: []", | |
" }>", | |
"}>()({", | |
" name: '$1',", | |
"", | |
" props: {", | |
" //", | |
" },", | |
"", | |
" setup (props, { slots }) {", | |
" useRender(() => (", | |
" <div>", | |
" { slots?.default?.() }", | |
" </div>", | |
" ))", | |
"", | |
" return {}", | |
" },", | |
"})", | |
"", | |
"export type $1 = InstanceType<typeof $1>", | |
"" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment