@@ -11,7 +11,7 @@ npm install vue-laravel-forms
11
11
12
12
## Setup
13
13
** Install plugin within project**
14
- ```
14
+ ``` javascript
15
15
import Vue from ' vue'
16
16
import { FormHelpers } from ' vue-laravel-forms'
17
17
@@ -20,13 +20,13 @@ Vue.use(FormHelpers);
20
20
21
21
or
22
22
23
- ```
23
+ ``` javascript
24
24
window .Vue = require (' vue' );
25
25
require (' vue-laravel-forms' );
26
26
```
27
27
28
28
Alternatively, you may import the various components of this plugin separately.
29
- ```
29
+ ``` javascript
30
30
import { Form , FormErrors , Http } from ' vue-laravel-forms'
31
31
32
32
window .AppForm = Form;
@@ -39,7 +39,7 @@ _.extend(App, new Http(Vue.http)) // Vue.http config needed
39
39
## Usage
40
40
### Creating a Form
41
41
_ Components installed via Vue_
42
- ```
42
+ ``` javascript
43
43
Vue .component (' user-registration-form' , {
44
44
forms: {
45
45
userRegistrationForm: {
@@ -53,7 +53,7 @@ Vue.component('user-registration-form', {
53
53
` ` `
54
54
55
55
_Components installed separately_
56
- ```
56
+ ` ` ` javascript
57
57
Vue .component (' user-registration-form' , {
58
58
data () {
59
59
return {
@@ -70,7 +70,7 @@ Vue.component('user-registration-form', {
70
70
71
71
### Submitting a Form
72
72
_Via a POST request (Components installed via Vue)_
73
- ```
73
+ ` ` ` javascript
74
74
Vue .component (' user-registration-form' , {
75
75
76
76
// Create your form using one of the techniques described above.
@@ -85,7 +85,7 @@ Vue.component('user-registration-form', {
85
85
` ` `
86
86
87
87
_Via a POST request (Components installed separately)_
88
- ```
88
+ ` ` ` javascript
89
89
Vue .component (' user-registration-form' , {
90
90
91
91
// Create your form using one of the techniques described above.
@@ -115,7 +115,7 @@ _Components installed Separately_
115
115
116
116
### Template Helpers
117
117
##### Check a field for errors
118
- ```
118
+ ` ` ` javascript
119
119
Vue .component (' user-registration-form' , {
120
120
121
121
methods: {
@@ -129,21 +129,23 @@ Vue.component('user-registration-form', {
129
129
130
130
##### Use the ` fieldClass` helper method
131
131
132
- ` formInstance.fieldClass(field, defaultClass, errorClass) `
133
-
132
+ ` ` ` javascript
133
+ formInstance . fieldClass (field, defaultClass, errorClass)
134
134
` ` `
135
+
136
+ ` ` ` vue
135
137
< div : class = " userRegistrationForm.fieldClass('email', 'form-group', 'has-error')" >
136
138
// Truncated for brevity
137
139
< / div>
138
140
` ` `
139
141
140
142
Alternatively, pass callbacks for ` defaultClass` and ` errorClass` .
141
- ```
143
+ ` ` ` vue
142
144
< div : class = " userRegistrationForm.fieldClass('email', getFieldClass, getFieldErrorClass)" >
143
145
// Truncated for brevity
144
146
< / div>
145
147
` ` `
146
- ```
148
+ ` ` ` javascript
147
149
Vue .component (' user-registration-form' , {
148
150
149
151
methods: {
@@ -160,7 +162,7 @@ Vue.component('user-registration-form', {
160
162
` ` `
161
163
162
164
##### Get the error message for a field
163
- ```
165
+ ` ` ` vue
164
166
< p class = " help-block" >
165
167
{{ userRegistrationForm .errors .get (' email' ) }}
166
168
< / p>
0 commit comments