fix: checkbox type
parent
dc9446fa19
commit
87216c5527
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
import hasProp from '../_util/props-util'
|
import hasProp from '../_util/props-util'
|
||||||
|
import PropTypes from '../_util/vue-types'
|
||||||
export default {
|
export default {
|
||||||
name: 'ACheckbox',
|
name: 'ACheckbox',
|
||||||
props: {
|
props: {
|
||||||
|
@ -14,6 +15,7 @@ export default {
|
||||||
value: [String, Number, Boolean],
|
value: [String, Number, Boolean],
|
||||||
name: String,
|
name: String,
|
||||||
indeterminate: Boolean,
|
indeterminate: Boolean,
|
||||||
|
type: PropTypes.string.def('checkbox'),
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
prop: 'checked',
|
prop: 'checked',
|
||||||
|
@ -52,14 +54,14 @@ export default {
|
||||||
handleChange (event) {
|
handleChange (event) {
|
||||||
const targetChecked = event.target.checked
|
const targetChecked = event.target.checked
|
||||||
this.$emit('input', targetChecked)
|
this.$emit('input', targetChecked)
|
||||||
const { name, value, checked, checkboxGroupContext, sChecked } = this
|
const { name, value, checked, checkboxGroupContext } = this
|
||||||
if ((checked === undefined && !checkboxGroupContext) || (checkboxGroupContext && checkboxGroupContext.sValue === undefined)) {
|
if ((checked === undefined && !checkboxGroupContext) || (checkboxGroupContext && checkboxGroupContext.sValue === undefined)) {
|
||||||
this.sChecked = targetChecked
|
this.sChecked = targetChecked
|
||||||
}
|
}
|
||||||
const target = {
|
const target = {
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
checked: !sChecked,
|
checked: targetChecked,
|
||||||
}
|
}
|
||||||
this.$emit('change', {
|
this.$emit('change', {
|
||||||
target,
|
target,
|
||||||
|
|
Loading…
Reference in New Issue