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

修复number组件

old
宇天 2020-07-13 19:26:29 +08:00
parent 1cf22b3ba0
commit a1af31826e
1 changed files with 15 additions and 3 deletions

View File

@ -247,18 +247,30 @@ export default class Number {
val = 0 val = 0
} }
this.props.value = val this.props.value = val
this.__INPUT__.value = this.props.value this.__INPUT__.value = val
this._checkActionEnable() this._checkActionEnable()
} }
_checkActionEnable() { _checkActionEnable() {
var { max, min, value } = this.props var { max, min, value } = this.props
var n = value
if (min !== null) {
if (min > n) {
n = min
}
this.__OUTER__.children[0].classList.toggle('disabled', value <= min)
}
if (max !== null) { if (max !== null) {
if (max < n) {
n = max
}
this.__OUTER__.children[2].classList.toggle('disabled', value >= max) this.__OUTER__.children[2].classList.toggle('disabled', value >= max)
} }
if (min !== null) { if (n !== value) {
this.__OUTER__.children[0].classList.toggle('disabled', value <= min) this.props.value = n
this.__INPUT__.value = n
} }
} }