fix: selection problem in ColorCheckBox radio mode; 🐛

修复:ColorCheckBox 单选模式下的选择问题;
master
iczer 4 years ago
parent 3ed878b8f3
commit 5c0ccf9df9
  1. 14
      src/components/checkbox/ColorCheckbox.vue

@ -44,18 +44,6 @@ const Group = {
watch: { watch: {
values(value) { values(value) {
this.$emit('change', value, this.colors) this.$emit('change', value, this.colors)
},
defaultValues(value) {
if (this.multiple) {
this.options.forEach(item => {
item.sChecked = value.indexOf(item.value) > -1
})
} else {
this.options.forEach(item => {
let first = value[0]
item.sChecked = first && first == item.value
})
}
} }
}, },
methods: { methods: {
@ -143,7 +131,7 @@ export default {
initChecked() { initChecked() {
let groupContext = this.groupContext let groupContext = this.groupContext
if (!groupContext) { if (!groupContext) {
return this.check return this.checked
}else if (groupContext.multiple) { }else if (groupContext.multiple) {
return groupContext.defaultValues.indexOf(this.value) > -1 return groupContext.defaultValues.indexOf(this.value) > -1
} else { } else {

Loading…
Cancel
Save