diff --git a/package.json b/package.json index 3383359..0557086 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bytedo/wcui", - "version": "1.0.9", + "version": "1.0.10", "type": "module", "description": "基于wc开发的一套UI库, 面向未来, 面向electron", "scripts": { diff --git a/src/form/input.wc b/src/form/input.wc index 131ef23..aa5f4a9 100644 --- a/src/form/input.wc +++ b/src/form/input.wc @@ -458,7 +458,7 @@ export default class Input { detail: item }) ) - this._handleChange(ev) + this._handleInput(ev) this.__LIST__.classList.remove('show') this.state.mvidx = null } @@ -525,7 +525,7 @@ export default class Input { }) // 输入状态事件 - this._handleChange = $.bind(this.__INPUT__, 'input', ev => { + this._handleInput = $.bind(this.__INPUT__, 'input', ev => { let now = Date.now() let { lazy } = this.props @@ -549,6 +549,10 @@ export default class Input { ) }) + this._handleChange = $.bind(this.__INPUT__, 'change', ev => { + this.dispatchEvent(ev) + }) + // 渲染建议列表 this._parseSuggestion = $.bind(this.__INPUT__, 'click', ev => { var { list } = this.state @@ -559,9 +563,9 @@ export default class Input { .join('') this.__LIST__.firstElementChild.firstElementChild.innerHTML = html this.__LIST__.classList.toggle('show', true) - this.__LIST__.style.cssText = `left:${x}px;top:${y + - height + - 5}px;width:${width}px;` + this.__LIST__.style.cssText = `left:${x}px;top:${ + y + height + 5 + }px;width:${width}px;` } else { this.__LIST__.classList.toggle('show', false) } @@ -576,18 +580,21 @@ export default class Input { if (ev.target.tagName === 'LI') { this._fetchSelect(ev.target.dataset.idx, ev) this.dispatchEvent(new CustomEvent('input')) + this.dispatchEvent(new CustomEvent('change')) } }) this._clearFn = $.bind(this.__CLOSE__, 'click', ev => { this.value = '' this.dispatchEvent(new CustomEvent('input')) + this.dispatchEvent(new CustomEvent('change')) }) } unmounted() { $.unbind(this.__INPUT__, 'keydown', this._handleSubmit) - $.unbind(this.__INPUT__, 'input', this._handleChange) + $.unbind(this.__INPUT__, 'input', this._handleInput) + $.unbind(this.__INPUT__, 'change', this._handleChange) $.unbind(this.__INPUT__, 'click', this._parseSuggestion) $.unbind(this.__LIST__, 'click', this._handleSelect) $.unbind(this.__CLOSE__, 'click', this._clearFn) diff --git a/src/table/index.wc b/src/table/index.wc index 740a931..1a5f6c8 100644 --- a/src/table/index.wc +++ b/src/table/index.wc @@ -88,7 +88,7 @@ export default class Table { } mounted() { - var tds = Array.from(this.children[0].children).map(it => { + var tds = Array.from(this.children[0]?.children).map(it => { let flex = +it.getAttribute('flex') || 1 let style = it.getAttribute('style')