This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

fixed bugs

old
yutent 2023-02-09 17:46:51 +08:00
parent 5788a411a1
commit 5851e0f6e8
3 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@bytedo/wcui", "name": "@bytedo/wcui",
"version": "1.0.9", "version": "1.0.10",
"type": "module", "type": "module",
"description": "基于wc开发的一套UI库, 面向未来, 面向electron", "description": "基于wc开发的一套UI库, 面向未来, 面向electron",
"scripts": { "scripts": {

View File

@ -458,7 +458,7 @@ export default class Input {
detail: item detail: item
}) })
) )
this._handleChange(ev) this._handleInput(ev)
this.__LIST__.classList.remove('show') this.__LIST__.classList.remove('show')
this.state.mvidx = null 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 now = Date.now()
let { lazy } = this.props 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 => { this._parseSuggestion = $.bind(this.__INPUT__, 'click', ev => {
var { list } = this.state var { list } = this.state
@ -559,9 +563,9 @@ export default class Input {
.join('') .join('')
this.__LIST__.firstElementChild.firstElementChild.innerHTML = html this.__LIST__.firstElementChild.firstElementChild.innerHTML = html
this.__LIST__.classList.toggle('show', true) this.__LIST__.classList.toggle('show', true)
this.__LIST__.style.cssText = `left:${x}px;top:${y + this.__LIST__.style.cssText = `left:${x}px;top:${
height + y + height + 5
5}px;width:${width}px;` }px;width:${width}px;`
} else { } else {
this.__LIST__.classList.toggle('show', false) this.__LIST__.classList.toggle('show', false)
} }
@ -576,18 +580,21 @@ export default class Input {
if (ev.target.tagName === 'LI') { if (ev.target.tagName === 'LI') {
this._fetchSelect(ev.target.dataset.idx, ev) this._fetchSelect(ev.target.dataset.idx, ev)
this.dispatchEvent(new CustomEvent('input')) this.dispatchEvent(new CustomEvent('input'))
this.dispatchEvent(new CustomEvent('change'))
} }
}) })
this._clearFn = $.bind(this.__CLOSE__, 'click', ev => { this._clearFn = $.bind(this.__CLOSE__, 'click', ev => {
this.value = '' this.value = ''
this.dispatchEvent(new CustomEvent('input')) this.dispatchEvent(new CustomEvent('input'))
this.dispatchEvent(new CustomEvent('change'))
}) })
} }
unmounted() { unmounted() {
$.unbind(this.__INPUT__, 'keydown', this._handleSubmit) $.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.__INPUT__, 'click', this._parseSuggestion)
$.unbind(this.__LIST__, 'click', this._handleSelect) $.unbind(this.__LIST__, 'click', this._handleSelect)
$.unbind(this.__CLOSE__, 'click', this._clearFn) $.unbind(this.__CLOSE__, 'click', this._clearFn)

View File

@ -88,7 +88,7 @@ export default class Table {
} }
mounted() { 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 flex = +it.getAttribute('flex') || 1
let style = it.getAttribute('style') let style = it.getAttribute('style')