[breaking change] Field: 修复组件错误的事件参数 (#391)

* 优化编译脚本,在预览时降低编译频率

* 修复 field 事件传参

* 降低等待事件
This commit is contained in:
Yao 2018-07-30 11:44:25 +08:00 committed by GitHub
parent 5ee309639a
commit d2ef7fbc03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1295 additions and 1148 deletions

View File

@ -7,6 +7,9 @@
placeholder="{{ config.base.name.placeholder }}" placeholder="{{ config.base.name.placeholder }}"
focus="{{ config.base.name.focus }}" focus="{{ config.base.name.focus }}"
value="{{ value }}" value="{{ value }}"
bind:change="handleZanFieldChange"
bind:focus="handleZanFieldFocus"
bind:blur="handleZanFieldBlur"
> >
</zan-field> </zan-field>
<zan-field <zan-field
@ -14,6 +17,7 @@
placeholder="{{ config.base.tel.placeholder }}" placeholder="{{ config.base.tel.placeholder }}"
error="{{ config.base.tel.error }}" error="{{ config.base.tel.error }}"
input-type="{{ config.base.tel.inputType }}" input-type="{{ config.base.tel.inputType }}"
bind:change="handleZanFieldChange"
> >
</zan-field> </zan-field>
<zan-field <zan-field
@ -21,12 +25,14 @@
type="{{ config.base.address.type }}" type="{{ config.base.address.type }}"
placeholder="{{ config.base.address.placeholder }}" placeholder="{{ config.base.address.placeholder }}"
maxlength="50" maxlength="50"
bind:change="handleZanFieldChange"
> >
</zan-field> </zan-field>
<zan-field <zan-field
title="{{ config.base.disabled.title }}" title="{{ config.base.disabled.title }}"
value="{{ config.base.disabled.value }}" value="{{ config.base.disabled.value }}"
disabled="{{ config.base.disabled.disabled }}" disabled="{{ config.base.disabled.disabled }}"
bind:change="handleZanFieldChange"
> >
</zan-field> </zan-field>
</zan-cell-group> </zan-cell-group>

2422
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -57,6 +57,7 @@
"gulp-remove-logging": "^1.2.0", "gulp-remove-logging": "^1.2.0",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-util": "^3.0.8", "gulp-util": "^3.0.8",
"lodash": "^4.17.10",
"node-watch": "^0.5.5", "node-watch": "^0.5.5",
"postcss-calc": "^6.0.1", "postcss-calc": "^6.0.1",
"postcss-easy-import": "^3.0.0", "postcss-easy-import": "^3.0.0",

View File

@ -44,15 +44,15 @@ Component({
const { value = '' } = detail; const { value = '' } = detail;
this.setData({ value }); this.setData({ value });
this.triggerEvent('change', event); this.triggerEvent('change', { ...detail });
}, },
handleFieldFocus(event) { handleFieldFocus({ detail = {} }) {
this.triggerEvent('focus', event); this.triggerEvent('focus', { ...detail });
}, },
handleFieldBlur(event) { handleFieldBlur({ detail = {} }) {
this.triggerEvent('blur', event); this.triggerEvent('blur', { ...detail });
}, },
updateIsLastElement(isLastField) { updateIsLastElement(isLastField) {

View File

@ -1,6 +1,7 @@
const path = require('path'); const path = require('path');
const fs = require('fs-extra'); const fs = require('fs-extra');
const nodeWatch = require('node-watch'); const nodeWatch = require('node-watch');
const debounce = require('lodash/debounce');
require('shelljs/global'); require('shelljs/global');
module.exports = function (config = {}) { module.exports = function (config = {}) {
@ -10,10 +11,11 @@ module.exports = function (config = {}) {
extracter(config); extracter(config);
if (config.watch) { if (config.watch) {
nodeWatch(config.src, { recursive: true }, () => extracter(config)); nodeWatch(config.src, { recursive: true }, () => debouncedFunc(config));
} }
}; };
const debouncedFunc = debounce(config => extracter(config), 500);
function extracter(config = {}) { function extracter(config = {}) {
// 复制 src // 复制 src