修复单选框组件v-model为数字时的 bug
parent
74f8e9544b
commit
c97bc5edfc
|
@ -67,8 +67,6 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
checked.splice(index, 1)
|
checked.splice(index, 1)
|
||||||
}
|
}
|
||||||
} else if (typeof this.checked == 'string') {
|
|
||||||
checked = this.bool ? this.value : ''
|
|
||||||
} else if (typeof this.checked == 'boolean') {
|
} else if (typeof this.checked == 'boolean') {
|
||||||
let bool = this.bool
|
let bool = this.bool
|
||||||
if (this.indeterminate) {
|
if (this.indeterminate) {
|
||||||
|
@ -78,6 +76,8 @@ export default {
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
checked = bool
|
checked = bool
|
||||||
|
} else {
|
||||||
|
checked = this.bool ? this.value : ''
|
||||||
}
|
}
|
||||||
this.$emit('input', checked)
|
this.$emit('input', checked)
|
||||||
this.$emit('change', checked)
|
this.$emit('change', checked)
|
||||||
|
@ -88,14 +88,14 @@ export default {
|
||||||
bool = value.includes(this.value)
|
bool = value.includes(this.value)
|
||||||
} else {
|
} else {
|
||||||
switch (typeof value) {
|
switch (typeof value) {
|
||||||
case 'string':
|
|
||||||
bool = value === this.value
|
|
||||||
break
|
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
bool = value
|
bool = value
|
||||||
break
|
break
|
||||||
|
// case 'string':
|
||||||
|
// case 'number':
|
||||||
default:
|
default:
|
||||||
return
|
bool = value === this.value
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue