Skip to content

Commit 0c34e3e

Browse files
committed
✏️ Add VueJS Resource http functions
1 parent cd035ad commit 0c34e3e

File tree

2 files changed

+135
-28
lines changed

2 files changed

+135
-28
lines changed

README.md

Lines changed: 95 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
[![apm](https://img.shields.io/apm/l/vuejs-snippets.svg?maxAge=2592000)](https://atom.io/packages/vuejs-snippets)
55
[![apm](https://img.shields.io/apm/v/vuejs-snippets.svg?maxAge=2592000)](https://atom.io/packages/vuejs-snippets)
66

7-
VueJS Components Snippets for Atom
7+
VueJS Snippets for Atom
88

99
---
1010

1111
## Types
1212

1313
- .text.html.vue
14+
- .text.js
15+
1416

1517
## Snippets
1618

19+
1720
### Vue Component
1821

1922
prefix: component
@@ -49,46 +52,110 @@ body:
4952
</script>
5053
```
5154

52-
### Vue Validator
55+
## Vue Validator
5356

57+
### Global
5458
prefix: validator
5559

5660
body:
57-
```
58-
Vue.validator("validatorName", function (val) {
59-
return true
60-
});
61-
```
61+
```
62+
Vue.validator("validatorName", function (val) {
63+
return true
64+
});
65+
```
6266

63-
### Vue Validator Local
67+
### Local
6468

6569
prefix: validators
6670

6771
body:
68-
```
69-
[..]
70-
validators: {
71-
nameOfValidator: function (val) {
72-
return true
73-
}
74-
},
75-
[...]
76-
```
7772

78-
### Vue Router map
73+
```
74+
[..]
75+
validators: {
76+
nameOfValidator: function (val) {
77+
return true
78+
}
79+
},
80+
[...]
81+
```
82+
83+
## Vue Router
84+
85+
### Map
7986

8087
prefix: map
8188

8289
body:
83-
```
84-
router.map({
85-
'/example': {
86-
component: Example,
87-
subRoutes:{
88-
'/subrouter': {
89-
component: SubRouter
90-
}
90+
91+
```
92+
router.map({
93+
'/example': {
94+
component: Example,
95+
subRoutes:{
96+
'/subrouter': {
97+
component: SubRouter
9198
}
9299
}
93-
})
94-
```
100+
}
101+
})
102+
```
103+
104+
## Vue Resource
105+
106+
### Get
107+
108+
prefix: get
109+
110+
body:
111+
112+
```
113+
CONTEXT.$http.get(URL).then((result) => {
114+
115+
}, (error) => {
116+
117+
})
118+
})
119+
```
120+
121+
### Post
122+
123+
prefix: post
124+
125+
body:
126+
127+
```
128+
CONTEXT.$http.post(URL, PARAMS).then((response) => {
129+
130+
}, (error) => {
131+
132+
})
133+
```
134+
135+
### Put
136+
137+
prefix: put
138+
139+
body:
140+
141+
```
142+
CONTEXT.$http.put(URL, PARAMS).then((response) => {
143+
144+
}, (error) => {
145+
146+
})
147+
```
148+
149+
### Delete
150+
151+
prefix: delete
152+
153+
body:
154+
155+
```
156+
CONTEXT.$http.delete(URL, PARAMS).then((response) => {
157+
158+
}, (error) => {
159+
160+
})
161+
```

snippets/vue-components.cson

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,43 @@
6464
}
6565
})
6666
"""
67+
'Vue HTTP Get':
68+
'prefix': 'get'
69+
'description': 'This snippet generates a Vue HTTP Get Request function'
70+
'body': """
71+
CONTEXT.$http.get(URL).then((result) => {
72+
73+
}, (error) => {
74+
75+
})
76+
"""
77+
'Vue HTTP Post':
78+
'prefix': 'post'
79+
'description': 'This snippet generates a Vue HTTP Post Request function'
80+
'body': """
81+
CONTEXT.$http.post(URL, PARAMS).then((response) => {
82+
83+
}, (error) => {
84+
85+
})
86+
"""
87+
'Vue HTTP Put':
88+
'prefix': 'put'
89+
'description': 'This snippet generates a Vue HTTP Put Request function'
90+
'body': """
91+
CONTEXT.$http.put(URL, PARAMS).then((response) => {
92+
93+
}, (error) => {
94+
95+
})
96+
"""
97+
'Vue HTTP Delete':
98+
'prefix': 'delete'
99+
'description': 'This snippet generates a Vue HTTP Delete Request function'
100+
'body': """
101+
CONTEXT.$http.delete(URL, PARAMS).then((response) => {
102+
103+
}, (error) => {
104+
105+
})
106+
"""

0 commit comments

Comments
 (0)