Skip to content

Add vue-template snippets #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
{
"language": "vue",
"path": "./snippets/vue.code-snippets"
},
{
"language": "html",
"path": "./snippets/vue-template.code-snippets"
}
]
}
Expand Down
92 changes: 92 additions & 0 deletions snippets/vue-template.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"Vue v-for": {
"prefix": "vfor",
"body": [
"<${1:div} v-for=\"${2:item} in ${2:item}s\" :key=\"${2:item}.id\">",
"\t{{ ${2:item} }}",
"</${1:div}>"
],
"description": "v-for statement"
},
"Vue v-model Directive": {
"prefix": "vmodel",
"body": ["<input v-model=\"${1:data}\" type=\"text\" />"],
"description": "v-model directive"
},
"Vue v-on Shortcut Directive": {
"prefix": "von",
"body": ["@click=\"${1:handler}(${2})\""],
"description": "v-on click handler"
},
"Vue Component with Props Binding": {
"prefix": "vel-props",
"body": ["<${1:component} :${1:propName}=\"${0}\"></${1:component}>"],
"description": "component element with props"
},
"Vue Named Slot": {
"prefix": "vslot-named",
"body": ["<template v-slot:${0:name}>${1:defaultcontent}</template>"],
"description": "named slot"
},
"Vue Image Source Binding": {
"prefix": "vimg",
"body": [
"<img :src=\"${1:imageSrc}\" :alt=\"${2:altText}\"/>"
],
"description": "image source binding"
},
"Vue Style Binding": {
"prefix": "vstyle",
"body": [":style=\"{ fontSize: ${2:data} + 'px' }\""],
"description": "vue inline style binding"
},
"Vue Style Binding Object": {
"prefix": "vstyle-obj",
"body": [
":style=\"[${2:styleObjectA}, ${3:styleObjectB]}\""
],
"description": "vue inline style binding, objects"
},
"Vue Class Binding": {
"prefix": "vclass",
"body": [":class=\"{ '${2:classList}': ${1:condition} }\""],
"description": "vue class binding"
},
"Vue Class Binding Ternary": {
"prefix": "vclass-ter",
"body": [
":class=\"[${1:condition} ? '${2:classListOnTrue}' : '${3:classListOnFalse}']\""
],
"description": "vue ternary class binding"
},
"Vue Transition": {
"prefix": "vtrans",
"body": [
"<Transition name=\"${1:transitionName}\">",
"\t${0}",
"</Transition>"
],
"description": "vue transition component"
},
"Vue Transition Group": {
"prefix": "vtrans-group",
"body": [
"<TransitionGroup name=\"${1:transitionName}\">",
"\t${0}",
"</TransitionGroup>"
],
"description": "vue transition group component"
},
"Vue Routing Link": {
"prefix": "vrlink",
"body": ["<router-link to=\"/${1:path}\">${2:linkTitle}</router-link>"],
"description": "vue router link"
},
"Vue Routing Link with param": {
"prefix": "vrlink-param",
"body": [
"<router-link :to=\"`/${1:path}/${${2:param}}`\">${3:linkTitle}</router-link>"
],
"description": "vue router link with param"
},
}