Skip to content

Commit a2096ee

Browse files
committed
feat: upgrade SFC (2.0.0)
1 parent eee2bfe commit a2096ee

18 files changed

+206
-189
lines changed

README.md

+44-38
Large diffs are not rendered by default.
78.2 KB
Loading

art/assets/sfc-composition-api.png

89.9 KB
Loading

art/assets/sfc-options-api.png

91.6 KB
Loading

art/assets/vue-language-blocks.png

-18.4 KB
Loading

art/assets/watch-composition-api.png

4.81 KB
Loading

art/assets/watch-options-api.png

-5.76 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.2.0",
7+
"version": "2.0.0",
88
"type": "module",
99
"galleryBanner": {
1010
"color": "#ffffff",

src/javascript/1.global-api/1.application.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"Vue: createApp()": {
3-
"prefix": ["createApp", "app"],
2+
"Vue Composition API: app": {
3+
"prefix": "vue-app",
44
"body": [
55
"import { createApp } from 'vue';",
66
"import App from './App.vue';",

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

+8-13
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@
8888
" },",
8989
");",
9090
""
91-
],
92-
"description": ""
91+
]
9392
},
9493
"Composition API: watch(), props, deep": {
9594
"prefix": [
@@ -107,8 +106,7 @@
107106
" }",
108107
");",
109108
""
110-
],
111-
"description": ""
109+
]
112110
},
113111
"Composition API: watch(), props, immediate": {
114112
"prefix": [
@@ -126,8 +124,7 @@
126124
" }",
127125
");",
128126
""
129-
],
130-
"description": ""
127+
]
131128
},
132129
"Composition API: watch(), props, deep, immediate": {
133130
"prefix": [
@@ -146,13 +143,12 @@
146143
" }",
147144
");",
148145
""
149-
],
150-
"description": ""
146+
]
151147
},
152-
"Composition API: watch(), props, immediate, multiple": {
148+
"Composition API: watch(), multiple props": {
153149
"prefix": [
154-
"watch-props-deep-immediate-multiple",
155-
"wdim"
150+
"watch-props-multiple",
151+
"wm"
156152
],
157153
"body": [
158154
"watch(",
@@ -166,7 +162,6 @@
166162
" }",
167163
");",
168164
""
169-
],
170-
"description": ""
165+
]
171166
}
172167
}
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
11
{
2-
"Composition API: getCurrentInstance()": {
2+
"Composition API: getCurrentInstance": {
33
"prefix": [
4-
"getCurrentInstance",
5-
"gci"
6-
],
7-
"body": [
8-
"const instance = getCurrentInstance();"
9-
],
10-
"description": "Composition API.\n`getCurrentInstance` enables access to an internal component instance useful for advanced usages or for library creators.\n"
11-
},
12-
"Composition API: proxy": {
13-
"prefix": [
14-
"proxy"
4+
"proxy",
5+
"gi"
156
],
167
"body": [
178
"const { proxy } = getCurrentInstance();"
189
]
19-
},
20-
"Vue: proxy.$router": {
21-
"prefix": "instance.proxy.$router",
22-
"body": [
23-
"proxy.\\$router$9"
24-
]
25-
},
26-
"Vue: proxy.$route": {
27-
"prefix": "proxy.$route",
28-
"body": [
29-
"proxy.\\$route"
30-
]
3110
}
3211
}

src/javascript/vue-router/router-instance-methods-composition-api.json

+36-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"router.push({ path })": {
1010
"prefix": "router-push-path",
1111
"body": [
12-
"router.push({ path: '${1:pathname}' });"
12+
"router.push({",
13+
" path: '${1:pathname}'",
14+
"});"
1315
],
1416
"description": "Router navigate to path.\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"
1517
},
@@ -18,7 +20,9 @@
1820
"body": [
1921
"router.push({",
2022
" path: ${1:'${2:pathname}'},",
21-
" params: { ${3:property}: ${4:'value'} },$0",
23+
" params: {",
24+
" ${3:property}: ${4:'value'},",
25+
" },$0",
2226
"});"
2327
],
2428
"description": "Router navigate to path with params.\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"
@@ -28,7 +32,9 @@
2832
"body": [
2933
"router.push({",
3034
" path: ${1:'${2:pathname}'},",
31-
" query: { ${3:property}: ${4:'value'} },$0",
35+
" query: {",
36+
" ${3:property}: ${4:'value'},",
37+
" },$0",
3238
"});"
3339
],
3440
"description": "Router navigate to path with query.\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"
@@ -38,15 +44,21 @@
3844
"body": [
3945
"router.push({",
4046
" path: ${1:'${2:pathname}'},",
41-
" params: { ${3:property}: ${4:'value'} },",
42-
" query: { ${5:property}: ${6:'value'} },$0",
47+
" params: {",
48+
" ${3:property}: ${4:'value'},",
49+
" },",
50+
" query: {",
51+
" ${5:property}: ${6:'value'},",
52+
" },$0",
4353
"});"
4454
]
4555
},
4656
"router.push({ name })": {
4757
"prefix": "router-push-name",
4858
"body": [
49-
"router.push({ name: '${1:routeName}' });"
59+
"router.push({",
60+
" name: '${1:routeName}'",
61+
"});"
5062
],
5163
"description": "Router navigate to named routes\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"
5264
},
@@ -55,7 +67,9 @@
5567
"body": [
5668
"router.push({",
5769
" name: ${1:'${2:routeName}'},",
58-
" params: { ${3:property}: ${4:'value'} },$0",
70+
" params: {",
71+
" ${3:property}: ${4:'value'},",
72+
" },$0",
5973
"});"
6074
],
6175
"description": "Router navigate to named routes with params.\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"
@@ -65,7 +79,9 @@
6579
"body": [
6680
"router.push({",
6781
" name: ${1:'${2:routeName}'},",
68-
" query: { ${3:property}: ${4:'value'} },$0",
82+
" query: {",
83+
" ${3:property}: ${4:'value'},",
84+
" },$0",
6985
"});"
7086
],
7187
"description": "Router navigate to named routes with query.\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"
@@ -75,8 +91,12 @@
7591
"body": [
7692
"router.push({",
7793
" name: ${1:'${2:routeName}'},",
78-
" params: { ${3:property}: ${4:'value'} },",
79-
" query: { ${5:property}: ${6:'value'} },$0",
94+
" params: {",
95+
" ${3:property}: ${4:'value'},",
96+
" },",
97+
" query: {",
98+
" ${5:property}: ${6:'value'},",
99+
" },$0",
80100
"});"
81101
]
82102
},
@@ -85,7 +105,9 @@
85105
"body": [
86106
"router.replace({",
87107
" path: ${1:'${2:pathname}'},",
88-
" params: { ${3:property}: ${4:'value'} },",
108+
" params: {",
109+
" ${3:property}: ${4:'value'},",
110+
" },",
89111
"});"
90112
],
91113
"description": "Router navigate to path without pushing a new history entry.\n#syntax:\nrouter.push(location, onComplete?, onAbort?)\nrouter.replace(location).then(onComplete).catch(onAbort)\n"
@@ -95,7 +117,9 @@
95117
"body": [
96118
"router.replace({",
97119
" name: ${1:'${2:routeName}'},",
98-
" params: { ${3:property}: ${4:'value'} },",
120+
" params: {",
121+
" ${3:property}: ${4:'value'},",
122+
" },",
99123
"});"
100124
],
101125
"description": "Router navigate to named routes without pushing a new history entry.\n#syntax:\nrouter.replace(location, onComplete?, onAbort?)\nrouter.push(location).then(onComplete).catch(onAbort)\n"

0 commit comments

Comments
 (0)