Skip to content

Commit 6ae1e4f

Browse files
committed
feat: release 1.1.0
1 parent 09c0566 commit 6ae1e4f

24 files changed

+185
-229
lines changed

README.md

+55-60
Large diffs are not rendered by default.

art/assets/computed.png

24.5 KB
Loading
File renamed without changes.
File renamed without changes.

art/assets/newVue.png

85.2 KB
Loading

art/assets/vue-language-blocks.png

35.2 KB
Loading

art/assets/watch-composition-api.png

24.3 KB
Loading

art/assets/watch-options-api.png

18.2 KB
Loading

art/assets/watch.png

66.3 KB
Loading

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"displayName": "Vue 3 Snippets",
55
"description": "Code snippets for Vue 3 (Only Vue 3.x, Vue Router 4.x)",
66
"icon": "art/icon.png",
7-
"version": "1.0.1",
7+
"version": "1.1.0",
88
"type": "module",
99
"galleryBanner": {
1010
"color": "#ffffff",

src/html/built-in-directives.json

+11-5
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,22 @@
4141
"v-for=\"${1:item} in ${2:items}\" :key=\"${4:item}\"$0"
4242
]
4343
},
44-
"v-slot": {
45-
"prefix": "v-slot",
44+
"v-slot, named": {
45+
"prefix": [
46+
"v-slot-named",
47+
"vsn"
48+
],
4649
"body": [
4750
"<template #${1:default}>",
4851
" $0",
4952
"</template>"
5053
]
5154
},
52-
"v-slot, props": {
53-
"prefix": "v-slot-props",
55+
"v-slot, named, props": {
56+
"prefix": [
57+
"v-slot-named-props",
58+
"vsnp"
59+
],
5460
"body": [
5561
"<template #${1:default}=\"${2:slotProps}\">",
5662
" $0",
@@ -74,7 +80,7 @@
7480
]
7581
},
7682
"v-slot, Longhand, props": {
77-
"prefix": "v-slot-props-longhand",
83+
"prefix": "v-slot-named-props-longhand",
7884
"body": [
7985
"<template v-slot:${1:default}=\"${2:slotProps}\">",
8086
" $0",

src/html/built-in-special-elements.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
"description": "Denotes slot content outlets in templates.\n"
1515
},
1616
"<slot>, Named": {
17-
"prefix": "slot-name",
17+
"prefix": "slot-named",
1818
"body": [
19-
"<slot name=\"${1:name}\"></slot>"
19+
"<slot name=\"${1:default}\"></slot>"
2020
],
2121
"description": "Named Slots.\n"
2222
},
2323
"<slot>, Scoped": {
24-
"prefix": "slot-scope",
24+
"prefix": "slot-scoped",
2525
"body": [
2626
"<slot ${2::${3:prop}}=\"${4:var}\"$5></slot>"
2727
],
2828
"description": "Named Slots.\n"
2929
},
3030
"<slot>, Named, Scoped": {
31-
"prefix": "slot-name-scope",
31+
"prefix": "slot-named-scoped",
3232
"body": [
33-
"<slot name=\"${1:name}\" ${2::${3:prop}}=\"${4:var}\"$5></slot>"
33+
"<slot name=\"${1:default}\" ${2::${3:prop}}=\"${4:var}\"$5></slot>"
3434
],
3535
"description": "Named Slots.\n"
3636
}

src/javascript/2.composition-api/component-instance.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"Composition API: getCurrentInstance()": {
3-
"prefix": "getCurrentInstance",
3+
"prefix": [
4+
"getCurrentInstance",
5+
"gci"
6+
],
47
"body": [
58
"const instance = getCurrentInstance();"
69
],

src/javascript/2.composition-api/lifecycle-hooks.json

+8
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@
107107
],
108108
"description": "SSR only.\nComposition API: Lifecycle Hooks.\nRegisters an async function to be resolved before the component instance is to be rendered on the server.\n"
109109
},
110+
"Composition API: async onBeforeMount()": {
111+
"prefix": "async-onBeforeMount",
112+
"body": [
113+
"onBeforeMount(async () => {",
114+
" $1",
115+
"});$0"
116+
]
117+
},
110118
"Composition API: async onMounted()": {
111119
"prefix": "async-onMounted",
112120
"body": [

src/javascript/2.composition-api/reactivity-core.json

+24-99
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
{
22
"Composition API: ref()": {
3-
"prefix": "ref",
3+
"prefix": [
4+
"ref",
5+
"r"
6+
],
47
"body": [
5-
"const ${1:state} = ref(${2:original});"
8+
"const ${1:feature} = ref(${2:null});"
69
],
710
"description": "Reactivity API - Refs.\nTakes an inner value and returns a reactive and mutable ref object. The ref object has a single property `.value` that points to the inner value.\n"
811
},
912
"Composition API: computed()": {
10-
"prefix": "computed",
13+
"prefix": [
14+
"computed",
15+
"c"
16+
],
1117
"body": [
1218
"const ${3:feature} = computed(() => ${1:state.value});"
1319
],
@@ -70,7 +76,7 @@
7076
"description": "Alias of watchEffect() with flush: 'sync' option.\n"
7177
},
7278
"Composition API: watch(), props": {
73-
"prefix": "watch-props",
79+
"prefix": "watch",
7480
"body": [
7581
"watch(",
7682
" () => props.${1:property},",
@@ -83,7 +89,10 @@
8389
"description": ""
8490
},
8591
"Composition API: watch(), props, deep": {
86-
"prefix": "watch-props-deep",
92+
"prefix": [
93+
"watch-props-deep",
94+
"wd"
95+
],
8796
"body": [
8897
"watch(",
8998
" () => props.${1:property},",
@@ -99,7 +108,10 @@
99108
"description": ""
100109
},
101110
"Composition API: watch(), props, immediate": {
102-
"prefix": "watch-props-immediate",
111+
"prefix": [
112+
"watch-props-immediate",
113+
"wi"
114+
],
103115
"body": [
104116
"watch(",
105117
" () => props.${1:property},",
@@ -114,26 +126,10 @@
114126
],
115127
"description": ""
116128
},
117-
"Composition API: watch(), props, immediate, multiple": {
118-
"prefix": "watch-props-immediate-multiple",
119-
"body": [
120-
"watch(",
121-
" [() => props.${1:property1}, () => props.${2:property2}],",
122-
" async ([$1, $2]) => {",
123-
" $0",
124-
" },",
125-
" {",
126-
" immediate: true,",
127-
" }",
128-
");",
129-
""
130-
],
131-
"description": ""
132-
},
133129
"Composition API: watch(), props, deep, immediate": {
134130
"prefix": [
135131
"watch-props-deep-immediate",
136-
"watch-props-immediate-deep"
132+
"wdi"
137133
],
138134
"body": [
139135
"watch(",
@@ -150,89 +146,18 @@
150146
],
151147
"description": ""
152148
},
153-
"Composition API: watch()": {
154-
"prefix": "watch",
155-
"body": [
156-
"watch(",
157-
" ${1:source},",
158-
" async (next${1/(.*)/${1:/pascalcase}/}) => {",
159-
" $0",
160-
" },",
161-
");",
162-
""
163-
],
164-
"description": ""
165-
},
166-
"Composition API: watch(), deep": {
167-
"prefix": [
168-
"watch-deep",
169-
"wd"
170-
],
171-
"body": [
172-
"watch(",
173-
" ${1:source},",
174-
" async (next${1/(.*)/${1:/pascalcase}/}) => {",
175-
" $0",
176-
" },",
177-
" {",
178-
" deep: true,",
179-
" }",
180-
");",
181-
""
182-
],
183-
"description": ""
184-
},
185-
"Composition API: watch(), immediate": {
186-
"prefix": [
187-
"watch-immediate",
188-
"wi"
189-
],
190-
"body": [
191-
"watch(",
192-
" ${1:source},",
193-
" async (next${1/(.*)/${1:/pascalcase}/}) => {",
194-
" $0",
195-
" },",
196-
" {",
197-
" immediate: true,",
198-
" }",
199-
");",
200-
""
201-
],
202-
"description": ""
203-
},
204-
"Composition API: watch(), immediate, multiple": {
205-
"prefix": [
206-
"watch-immediate-multiple",
207-
"wim"
208-
],
209-
"body": [
210-
"watch(",
211-
" [${1:source1}, ${2:source2}],",
212-
" async ([next${1/(.*)/${1:/pascalcase}/}, next${2/(.*)/${1:/pascalcase}/}], [prev${1/(.*)/${1:/pascalcase}/}, prev${2/(.*)/${1:/pascalcase}/}]) => {",
213-
" $0",
214-
" },",
215-
" {",
216-
" immediate: true,",
217-
" }",
218-
");",
219-
""
220-
],
221-
"description": ""
222-
},
223-
"Composition API: watch(), deep, immediate": {
149+
"Composition API: watch(), props, immediate, multiple": {
224150
"prefix": [
225-
"watch-deep-immediate",
226-
"wdi"
151+
"watch-props-immediate-multiple",
152+
"wmi"
227153
],
228154
"body": [
229155
"watch(",
230-
" ${1:source1},",
231-
" async (next${1/(.*)/${1:/pascalcase}/}) => {",
156+
" [() => props.${1:property1}, () => props.${2:property2}],",
157+
" async ([$1, $2]) => {",
232158
" $0",
233159
" },",
234160
" {",
235-
" deep: true,",
236161
" immediate: true,",
237162
" }",
238163
");",

src/javascript/3.options-api/computed.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"computed property": {
2+
"Options API: computed property": {
33
"prefix": [
44
"computed-property",
55
"cp"
@@ -11,7 +11,7 @@
1111
""
1212
]
1313
},
14-
"computed property, get, set": {
14+
"Options API: computed property: { get, set }": {
1515
"prefix": [
1616
"computed-property-get-set",
1717
"cpgs"

src/javascript/3.options-api/options-misc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"description": "Controls whether the default component attribute fallthrough behavior should be enabled.\n"
2020
},
21-
"Options API: components{}": {
21+
"Options API: components": {
2222
"prefix": [
2323
"option-components",
2424
"ocs"
@@ -28,7 +28,7 @@
2828
],
2929
"description": "An object that registers components to be made available to the component instance.\n"
3030
},
31-
"Options API: directives{}": {
31+
"Options API: directives": {
3232
"prefix": [
3333
"option-directives",
3434
"ods"

src/javascript/3.options-api/options-state.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"Options API: computed{}": {
2929
"prefix": [
3030
"option-computed",
31-
"ocd"
31+
"oc"
3232
],
3333
"body": [
3434
"computed: {",
@@ -43,7 +43,7 @@
4343
"Options API: methods{}": {
4444
"prefix": [
4545
"option-methods",
46-
"oms"
46+
"om"
4747
],
4848
"body": [
4949
"methods: {",

src/javascript/3.options-api/watch.json

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"watch property, deep, immediate": {
4545
"prefix": [
4646
"watch-property-deep-immediate",
47-
"watch-property-immediate-deep",
4847
"wpdi"
4948
],
5049
"body": [

src/javascript/4.single-file-component/sfc-script-setup.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"defineModel"
2828
],
2929
"body": [
30-
"const model = defineModel(${1});"
30+
"const ${2:value} = defineModel(${1:'value'});"
3131
],
3232
"description": "The prop name will default to \"modelValue\".\n// declares \"modelValue\" prop, consumed by parent via v-model\nconst model = defineModel();\n// OR: declares \"modelValue\" prop with options\nconst model = defineModel({ type: String })\n// emits \"update:modelValue\" when mutated\nmodel.value = 'hello'\n"
3333
},

0 commit comments

Comments
 (0)