Skip to content

Commit e51396f

Browse files
authored
Merge pull request #6 from DannyFeliz/master
Improve documentation syntax highlighting
2 parents 9b5aaa7 + 6ab1b1d commit e51396f

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ npm install vue-laravel-forms
1111

1212
## Setup
1313
**Install plugin within project**
14-
```
14+
```javascript
1515
import Vue from 'vue'
1616
import { FormHelpers } from 'vue-laravel-forms'
1717

@@ -20,13 +20,13 @@ Vue.use(FormHelpers);
2020

2121
or
2222

23-
```
23+
```javascript
2424
window.Vue = require('vue');
2525
require('vue-laravel-forms');
2626
```
2727

2828
Alternatively, you may import the various components of this plugin separately.
29-
```
29+
```javascript
3030
import { Form, FormErrors, Http } from 'vue-laravel-forms'
3131

3232
window.AppForm = Form;
@@ -39,7 +39,7 @@ _.extend(App, new Http(Vue.http)) // Vue.http config needed
3939
## Usage
4040
### Creating a Form
4141
_Components installed via Vue_
42-
```
42+
```javascript
4343
Vue.component('user-registration-form', {
4444
forms: {
4545
userRegistrationForm: {
@@ -53,7 +53,7 @@ Vue.component('user-registration-form', {
5353
```
5454
5555
_Components installed separately_
56-
```
56+
```javascript
5757
Vue.component('user-registration-form', {
5858
data() {
5959
return {
@@ -70,7 +70,7 @@ Vue.component('user-registration-form', {
7070
7171
### Submitting a Form
7272
_Via a POST request (Components installed via Vue)_
73-
```
73+
```javascript
7474
Vue.component('user-registration-form', {
7575

7676
// Create your form using one of the techniques described above.
@@ -85,7 +85,7 @@ Vue.component('user-registration-form', {
8585
```
8686
8787
_Via a POST request (Components installed separately)_
88-
```
88+
```javascript
8989
Vue.component('user-registration-form', {
9090

9191
// Create your form using one of the techniques described above.
@@ -115,7 +115,7 @@ _Components installed Separately_
115115
116116
### Template Helpers
117117
##### Check a field for errors
118-
```
118+
```javascript
119119
Vue.component('user-registration-form', {
120120

121121
methods: {
@@ -129,21 +129,23 @@ Vue.component('user-registration-form', {
129129
130130
##### Use the `fieldClass` helper method
131131
132-
`formInstance.fieldClass(field, defaultClass, errorClass)`
133-
132+
```javascript
133+
formInstance.fieldClass(field, defaultClass, errorClass)
134134
```
135+
136+
```vue
135137
<div :class="userRegistrationForm.fieldClass('email', 'form-group', 'has-error')">
136138
// Truncated for brevity
137139
</div>
138140
```
139141
140142
Alternatively, pass callbacks for `defaultClass` and `errorClass`.
141-
```
143+
```vue
142144
<div :class="userRegistrationForm.fieldClass('email', getFieldClass, getFieldErrorClass)">
143145
// Truncated for brevity
144146
</div>
145147
```
146-
```
148+
```javascript
147149
Vue.component('user-registration-form', {
148150

149151
methods: {
@@ -160,7 +162,7 @@ Vue.component('user-registration-form', {
160162
```
161163
162164
##### Get the error message for a field
163-
```
165+
```vue
164166
<p class="help-block">
165167
{{ userRegistrationForm.errors.get('email') }}
166168
</p>

0 commit comments

Comments
 (0)