fix: selection problem in ColorCheckBox radio mode; 🐛

修复:ColorCheckBox 单选模式下的选择问题;
master
iczer 4 years ago
parent 36e9e0a9f0
commit c6ba8815fb
  1. 13
      src/components/checkbox/ColorCheckbox.vue

@ -42,8 +42,8 @@ const Group = {
}
},
watch: {
values() {
this.$emit('change', this.values, this.colors)
values(value) {
this.$emit('change', value, this.colors)
},
defaultValues(value) {
if (this.multiple) {
@ -61,9 +61,12 @@ const Group = {
methods: {
handleChange (option) {
if (!option.checked) {
this.values = this.values.filter(item => item !== option.value)
if (this.values.indexOf(option.value) > -1) {
this.values = this.values.filter(item => item != option.value)
}
} else {
if (!this.multiple) {
this.values = [option.value]
this.options.forEach(item => {
if (item.value != option.value) {
item.sChecked = false
@ -133,7 +136,9 @@ export default {
},
methods: {
toggle () {
this.sChecked = !this.sChecked
if (this.groupContext.multiple || !this.sChecked) {
this.sChecked = !this.sChecked
}
},
initChecked() {
let groupContext = this.groupContext

Loading…
Cancel
Save