From c53f79f94fe2e35aca621024a42e54d2e479d33c Mon Sep 17 00:00:00 2001 From: zouhang Date: Mon, 31 Aug 2020 21:45:59 +0800 Subject: [PATCH] fix(checkbox): change provided props to reactive --- packages/checkbox/doc/basic.vue | 2 ++ packages/checkbox/doc/group.vue | 7 ++++++- packages/checkbox/src/checkbox-button.vue | 11 ++++++----- packages/checkbox/src/checkbox-group.vue | 16 ++++++---------- packages/checkbox/src/checkbox.d.ts | 12 ++++++------ packages/checkbox/src/checkbox.vue | 3 ++- packages/checkbox/src/useCheckbox.ts | 20 +++++++++----------- 7 files changed, 37 insertions(+), 34 deletions(-) diff --git a/packages/checkbox/doc/basic.vue b/packages/checkbox/doc/basic.vue index f6ac589664..e6daa3166d 100644 --- a/packages/checkbox/doc/basic.vue +++ b/packages/checkbox/doc/basic.vue @@ -7,6 +7,7 @@ {{ checked4 }} + @@ -27,6 +28,7 @@ export default defineComponent({ checked2: true, checkList: ['Ha','A'], checked4: 3, + checkbox: false, } }, methods: { diff --git a/packages/checkbox/doc/group.vue b/packages/checkbox/doc/group.vue index 2d61581b71..8cf786a76e 100644 --- a/packages/checkbox/doc/group.vue +++ b/packages/checkbox/doc/group.vue @@ -39,7 +39,7 @@
- + {{ city }}
@@ -60,8 +60,13 @@ export default defineComponent({ checkboxGroup2: ['NYC'], checkboxGroup3: ['NYC'], checkboxGroup4: ['NYC'], + + size: 'mini', } }, + mounted() { + setTimeout(() => this.size = 'medium', 3000) + }, methods: { handleCheckAllChange(val) { this.checkedCities = val ? cityOptions : [] diff --git a/packages/checkbox/src/checkbox-button.vue b/packages/checkbox/src/checkbox-button.vue index 225235830e..20f16d77ac 100644 --- a/packages/checkbox/src/checkbox-button.vue +++ b/packages/checkbox/src/checkbox-button.vue @@ -54,6 +54,7 @@ import { computed, PropType, } from 'vue' +import { UPDATE_MODEL_EVENT } from '@element-plus/utils/constants' import { useCheckbox, useCheckboxGroup } from './useCheckbox' export default defineComponent({ @@ -82,17 +83,17 @@ export default defineComponent({ default: undefined, }, }, - emits: ['update:modelValue', 'change'], + emits: [UPDATE_MODEL_EVENT, 'change'], setup(props) { const { focus, isChecked, isDisabled, size, model, handleChange } = useCheckbox(props) const { checkboxGroup } = useCheckboxGroup() const activeStyle = computed(() => { return { - backgroundColor: checkboxGroup.fill || '', - borderColor: checkboxGroup.fill || '', - color: checkboxGroup.textColor || '', - boxShadow: '-1px 0 0 0 ' + checkboxGroup.fill, + backgroundColor: checkboxGroup.fill?.value || '', + borderColor: checkboxGroup.fill?.value || '', + color: checkboxGroup.textColor?.value || '', + boxShadow: '-1px 0 0 0 ' + checkboxGroup.fill?.value, } }) diff --git a/packages/checkbox/src/checkbox-group.vue b/packages/checkbox/src/checkbox-group.vue index d2bc0f4ca4..1ea7a9fa15 100644 --- a/packages/checkbox/src/checkbox-group.vue +++ b/packages/checkbox/src/checkbox-group.vue @@ -5,7 +5,8 @@