-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.snippets
153 lines (127 loc) · 1.85 KB
/
vue.snippets
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
snippet vs
<template>
<div class="${1}"></div>
</template>
<script>
export default {
name: '${1}',
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
.${1} {}
</style>
endsnippet
snippet vc
created () {
${0}
}
endsnippet
snippet vm
mounted () {
${0}
},
endsnippet
snippet vw
watch: {
${1} () {}
},
endsnippet
snippet vwd
watch: {
${0}: {
handler (value, oldValue) {
},
deep: true,
immediate: true
}
},
endsnippet
snippet vcmp
components: {
${1}
},
endsnippet
snippet vprops
props: {
${1}: {
type: Object,
default: () => ({})
}
},
endsnippet
snippet foreach
${0}.forEach((val, idx) => {
})
endsnippet
snippet tick
this.nextTick(_ => {
${0}
})
endsnippet
snippet "([^\s]\w+)\.log" "clg" r
console.log($0`!p snip.rv = match.group(1)`)
endsnippet
snippet json
JSON.parse(JSON.stringify($0))
endsnippet
snippet "fn\.([^\s]\w+)\.(\w+)" "fn.name" r
function `!p snip.rv = match.group(1)` (`!p snip.rv = match.group(2)`) {
$0
}
endsnippet
snippet "const\.([^\s]\w+)\.(\w+)" "fn.name" r
const `!p snip.rv = match.group(1)` = (`!p snip.rv = match.group(2)`) => {
$0
}
endsnippet
snippet "([^\s]\w+)\(\)" "fn()" r
`!p snip.rv = match.group(1)` () {
$0
}
endsnippet
snippet clear "clear both" b
.clear:after {
content: " ";
display: table;
clear: both;
}
endsnippet
snippet clear "clear both" b
.clear:after {
content: " ";
display: table;
clear: both;
}
endsnippet
snippet flex "flex" b
display: flex;
justify-content: center;
align-items: center;
endsnippet
snippet vf "vf" b
<template v-for="(${1:item}, idx) in ${0}" :key="idx"></template>
endsnippet
snippet bg "bg" i
background-color: ${1:#fff};
endsnippet
snippet if "Description" b
if (${1}) {
}
endsnippet
snippet ifelse "Description" b
if (${1}) {
} else {
}
endsnippet
snippet swh "Description" b
switch ($0) {
case value:
break
default:
break
}
endsnippet