-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathjavascript.json
More file actions
139 lines (139 loc) · 4.04 KB
/
javascript.json
File metadata and controls
139 lines (139 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{
// Place your 全局 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"function": {
"prefix": "fn",
"body": ["function ${1:name}(${2:args}) {", " $3", "}"],
"description": "function方法"
},
"arrow": {
"prefix": "arrowFunction 新建方法",
"body": ["const fn = (${1}) => {", " ${2}", "};"],
"description": "方法"
},
"import": {
"prefix": ["_import", "import"],
"body": "import ${2:name} from '${1:module}'",
"description": "import 导入"
},
"require": {
"prefix": ["_require", "require"],
"body": ["const ${1:name} = require('${2:path}');"],
"description": "require 导入模板"
},
"log": {
"prefix": ["_log", "log"],
"body": ["console.log('$1');", "$2"],
"description": "Log output to console"
},
"forEach": {
"prefix": "_forEach",
"body": ["${1:array}.forEach((${2:i}) => {", " ${3}", "})"],
"description": "forEach"
},
"map": {
"prefix": "_map",
"body": ["${1:array}.map((${2:item}) => {", " ${3}", "})"],
"description": "map"
},
"filter": {
"prefix": "_filter",
"body": ["${1:array}.filter((${2:item}) => {", " ${3}", "})"],
"description": "filter 过滤"
},
"some": {
"prefix": ["some", "_some"],
"body": ["${1:array}.some((${2:item}) => {", " ${3}", "})"],
"description": "some"
},
"every": {
"prefix": ["_every", "every"],
"body": ["${1:array}.every((${2:item}) => {", " ${3}", "})"],
"description": "every"
},
"useAttrs": {
"prefix": "_useAttrs",
"body": ["const attrs = useAttrs()"],
"description": "useAttrs"
},
"defineProps": {
"prefix": "_defineProps",
"body": ["const props = defineProps()"],
"description": "defineProps"
},
"ref": {
"prefix": "_ref",
"body": ["const $1 = ref(${2})"],
"description": "ref"
},
"reactive": {
"prefix": "_reactive",
"body": ["const $1 = reactive(${2})"],
"description": "reactive"
},
"useToggle": {
"prefix": "_useToggle",
"body": ["const toggle = useToggle(mode)"],
"description": "_useToggle"
},
"useElementBounding": {
"prefix": "_useElementBounding",
"body": ["const rect = useElementBounding(el)"],
"description": "useElementBounding"
},
"watch": {
"prefix": "_watch",
"body": ["watch(${1:ref}, (value) => {", " ${2}", "})"],
"description": "useElementBounding"
},
"computed": {
"prefix": "_computed",
"body": ["const result = computed(() => {", " ${1}", "})"],
"description": "computed"
},
"useEventListener": {
"prefix": "_useEventListener",
"body": "useEventListener('resize', update)",
"description": "useEventListener"
},
"watchEffect": {
"prefix": "_watchEffect",
"body": ["watchEffect(() => {", " ${1}", "})"],
"description": "watchEffect"
},
"useStorage": {
"prefix": "_useStorage",
"body": ["useStorage('${1:key}', ${2:defaultValue})"],
"description": "useStorage"
},
"forloop": {
"prefix": "forloop",
"body": ["for (let i = 0; i < ${1:content}; i++) {", " $2", "}"],
"description": "for loop"
},
"forin": {
"prefix": "forin",
"body": [
"for (const key in ${1:object}) {",
" const val = $1[key]",
" $2",
"}"
],
"description": "for in"
},
"forof": {
"prefix": "forof",
"body": ["for (const item of ${1:array}) {", " $2", "}"],
"description": "for of"
},
"forawait": {
"prefix": "forawait",
"body": ["for await (const item of ${1:array) {", " $2", "}"],
"description": "for await of"
}
}