Skip to content

Commit dc17006

Browse files
committed
docs: commenting methods
1 parent 307e903 commit dc17006

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/formGenerator.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ div
6262
watch: {
6363
// new model loaded
6464
model: function(newModel, oldModel) {
65-
if (oldModel == newModel) // model got a new property
65+
if (oldModel == newModel) // model got a new property, skip
6666
return;
6767
68-
//console.log("Model changed!");
68+
// Model changed!
6969
if (this.options.validateAfterLoad === true && this.isNewModel !== true)
7070
this.validate();
7171
else
@@ -74,14 +74,15 @@ div
7474
},
7575
7676
compiled() {
77-
// First load
77+
// First load, running validation if neccessary
7878
if (this.options && this.options.validateAfterLoad === true && this.isNewModel !== true)
7979
this.validate();
8080
else
8181
this.clearValidationErrors();
8282
},
8383
8484
methods: {
85+
// Get style classes of field
8586
getFieldRowClasses(field) {
8687
let baseClasses = {
8788
error: field.errors && field.errors.length > 0,
@@ -103,10 +104,12 @@ div
103104
return baseClasses;
104105
},
105106
107+
// Get type of field 'field-xxx'. It'll be the name of HTML element
106108
getFieldType(fieldSchema) {
107109
return "field-" + fieldSchema.type;
108110
},
109111
112+
// Get disabled attr of field
110113
fieldDisabled(field) {
111114
if (isFunction(field.disabled))
112115
return field.disabled(this.model);
@@ -117,6 +120,7 @@ div
117120
return field.disabled;
118121
},
119122
123+
// Get visible prop of field
120124
fieldVisible(field) {
121125
if (isFunction(field.visible))
122126
return field.visible(this.model);
@@ -127,6 +131,7 @@ div
127131
return field.visible;
128132
},
129133
134+
// Validating the model properties
130135
validate() {
131136
this.clearValidationErrors();
132137
@@ -146,6 +151,7 @@ div
146151
return this.errors.length == 0;
147152
},
148153
154+
// Clear validation errors
149155
clearValidationErrors() {
150156
this.errors.splice(0);
151157

0 commit comments

Comments
 (0)