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

修复单选/复选的状态

old
宇天 2021-04-15 18:47:53 +08:00
parent e86f729537
commit 8e50f43946
4 changed files with 14 additions and 12 deletions

View File

@ -283,7 +283,7 @@ export default class Checkbox {
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
this[k] = val !== null
break
}
}

View File

@ -117,13 +117,13 @@ export default class CheckboxGroup {
case 'readonly':
case 'disabled':
var k = name
if (k === 'readonly') {
k = 'readOnly'
}
Array.from(this.children).forEach(it => {
if (it.tagName === 'WC-CHECKBOX' && it.root) {
if (val === null) {
it.removeAttribute(name)
} else {
it.setAttribute(name, '')
}
it[k] = val !== null
}
})
break

View File

@ -269,7 +269,7 @@ export default class Radio {
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
this[k] = val !== null
break
}
}

View File

@ -104,13 +104,15 @@ export default class RadioGroup {
case 'readonly':
case 'disabled':
var k = name
if (k === 'readonly') {
k = 'readOnly'
}
console.log('变了', k, val, typeof val)
Array.from(this.children).forEach(it => {
if (it.tagName === 'WC-RADIO' && it.root) {
if (val === null) {
it.removeAttribute(name)
} else {
it.setAttribute(name, '')
}
it[k] = val !== null
console.log('-----', k, it[k], val !== null, '-----')
}
})
break