Skip to content

Instantly share code, notes, and snippets.

@ainsofs
Last active June 23, 2022 05:49
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 ainsofs/8efbf7452a38ed854f13b10b685c929c to your computer and use it in GitHub Desktop.
Save ainsofs/8efbf7452a38ed854f13b10b685c929c to your computer and use it in GitHub Desktop.
Vue3 Component template and snippet for vscode
<template>
<div>
<!--start-here-->
</div>
</template>
<script setup>
import { ref, computed } from 'vue'
// props and emits
const props = defineProps(['someProp'])
const emits = defineEmits(['someEmit'])
// data
const someVal = ref(null)
//computed
const someComputed = computed(() => {
return null
})
//functions
function someFunction() {
// code here
}
</script>
{
"Vue3 Component Snippet by Ainsof So'o": {
"prefix": "vue3-default",
"body": [
"<template>",
"<div>",
" <!--start-here-->",
"</div>",
"</template>",
"",
"<script setup>",
"import { ref, computed } from 'vue'",
"// props and emits",
"const props = defineProps(['someProp'])",
"const emits = defineEmits(['someEmit'])",
"// data",
"const someVal = ref(null)",
"//computed",
"const someComputed = computed(() => {",
" return null",
"})",
"//functions",
"function someFunction() {",
" // code here",
"}",
"</script>"
],
"description": "Vue3 Component Snippet by Ainsof So'o"
},
"Create props": {
"prefix": "props",
"body": ["const props = defineProps(['someProp'])"],
"description": "Create props"
},
"Create emits": {
"prefix": "emits",
"body": ["const emit = defineEmits(['someEmit'])"],
"description": "Create emits"
},
"Create ref": {
"prefix": "ref",
"body": ["import { ref } from 'vue'", "const someVal = ref(null)"],
"description": "Create ref"
},
"Create computed ": {
"prefix": "computed ",
"body": [
"import { computed } from 'vue'",
"const someComputed = computed(() => {",
" return null",
"})"
],
"description": "Create computed "
}
}
{
"Vue3 Component Snippet by Ainsof So'o": {
"prefix": "vue3-default",
"body": [
"<template>",
"<div>",
" <!--start-here-->",
"</div>",
"</template>",
"",
"<script setup>",
"import { ref, computed } from 'vue'",
"// props and emits",
"const props = defineProps(['someProp'])",
"const emits = defineEmits(['someEmit'])",
"// data",
"const someVal = ref(null)",
"//computed",
"const someComputed = computed(() => {",
" return null",
"})",
"//functions",
"function someFunction() {",
" // code here",
"}",
"</script>"
],
"description": "Vue3 Component Snippet by Ainsof So'o"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment