Skip to content

Commit c60da69

Browse files
committed
build: Travis CI automatic compilation
1 parent e585c7d commit c60da69

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

dist/form/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dist/form/index.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import eventBus from '../core/utils/event-bus.js';
2+
import eventUtil from '../core/utils/event-util';
23
Component({
34
/**
45
* 组件的属性列表
@@ -10,12 +11,12 @@ Component({
1011
relations: {
1112
'../form-item/index': {
1213
type: 'child',
13-
linked: function(target) {
14+
linked: function (target) {
1415
this._initItem(target);
1516
},
16-
linkChanged: function() {
17+
linkChanged: function () {
1718
},
18-
unlinked: function() {
19+
unlinked: function () {
1920
}
2021
}
2122
},
@@ -35,7 +36,7 @@ Component({
3536
this._init();
3637
},
3738
detached() {
38-
for(let key in this._keys) {
39+
for (let key in this._keys) {
3940
if (Object.prototype.hasOwnProperty.call(this._keys, key)) {
4041
eventBus.off(`lin-form-blur-${key}`);
4142
eventBus.off(`lin-form-change-${key}`);
@@ -83,11 +84,11 @@ Component({
8384
});
8485
eventBus.on(`lin-form-change-${key}`, (id) => {
8586
clearTimeout(this.change_time);
86-
this.change_time = setTimeout(()=>{
87+
this.change_time = setTimeout(() => {
8788
this._validateItem(id, 'change');
8889
}, 200);
8990
});
90-
if(this._keys[key]) {
91+
if (this._keys[key]) {
9192
throw new Error(`表单项存在重复的name:${key}`);
9293
}
9394
this._keys[key] = '';
@@ -100,9 +101,9 @@ Component({
100101
let params = this._getValues();
101102

102103
const items = this.getRelationNodes('../form-item/index');
103-
const currentTarget = items.find(item => item.properties.name === id);
104+
const currentTarget = items.find(item => item.properties.name === id);
104105
const formItem = _this.selectComponent(`#${id}`);
105-
if(formItem) {
106+
if (formItem) {
106107
currentTarget.validatorData(params, type);
107108
} else {
108109
throw new Error(`表单项不存在name:${id}`);
@@ -129,7 +130,7 @@ Component({
129130
this._forEachNodes(item => {
130131
const id = item.properties.name;
131132
const formItem = _this.selectComponent(`#${id}`);
132-
if(formItem) {
133+
if (formItem) {
133134
item.validatorData(params);
134135
} else {
135136
throw new Error(`表单项不存在name:${id}`);
@@ -147,18 +148,18 @@ Component({
147148
this._forEachNodes(item => {
148149
const _id = item.properties.name;
149150
const formItem = _this.selectComponent(`#${_id}`);
150-
if(formItem) {
151+
if (formItem) {
151152
params[_id] = formItem.getValues();
152153
}
153154
});
154155
return params;
155156
},
156157

157158
submit() {
158-
let errors = this.data.isSubmitValidate ? this._validateForm(): [];
159+
let errors = this.data.isSubmitValidate ? this._validateForm() : [];
159160
this.triggerEvent('linsubmit', {
160161
values: this._getValues(),
161-
errors: this.data.isSubmitValidate ? this._errors: {},
162+
errors: this.data.isSubmitValidate ? this._errors : {},
162163
isValidate: errors.length === 0
163164
});
164165
},
@@ -170,10 +171,11 @@ Component({
170171
});
171172
const _id = item.properties.name;
172173
const formItem = _this.selectComponent(`#${_id}`);
173-
if(formItem) {
174+
if (formItem) {
174175
formItem.reset();
175176
}
176177
});
178+
eventUtil.emit(this, 'linreset');
177179
}
178180
}
179181
});

0 commit comments

Comments
 (0)