Browse Source

fix: checkbox emit unexpected value (#3549)

pull/3577/head
zkwolf 4 years ago committed by GitHub
parent
commit
22c81f909b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      components/vc-checkbox/src/Checkbox.jsx

11
components/vc-checkbox/src/Checkbox.jsx

@ -69,11 +69,6 @@ export default defineComponent({
if (!('checked' in props)) {
this.sChecked = e.target.checked;
}
// fix https://github.com/vueComponent/ant-design-vue/issues/3047
if ('checked' in props) {
this.$refs.input.checked = props.checked;
}
this.$forceUpdate(); // change
e.shiftKey = this.eventShiftKey;
const eventObj = {
target: {
@ -88,6 +83,12 @@ export default defineComponent({
},
nativeEvent: e,
};
// fix https://github.com/vueComponent/ant-design-vue/issues/3047
//
if ('checked' in props) {
this.$refs.input.checked = props.checked;
}
this.__emit('update:checked', eventObj);
this.__emit('change', eventObj);
this.eventShiftKey = false;

Loading…
Cancel
Save