From eaa66f6d5ae499b2a737a80cf36cf9ce9bb35be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0o=E5=BC=A0=E4=B8=8D=E6=AD=AAo0?= Date: Wed, 13 Jul 2022 16:12:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20=E6=96=B0=E5=A2=9ECheck?= =?UTF-8?q?BoxGroup=20disabled=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/checkbox/index.vue | 5 +++-- .../src/component/checkboxGroup/index.vue | 7 +++++-- .../src/document/zh-CN/components/checkbox.md | 18 ++++++++++++++++++ .../src/document/zh-CN/guide/changelog.md | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/package/component/src/component/checkbox/index.vue b/package/component/src/component/checkbox/index.vue index 25475c37..0076976f 100644 --- a/package/component/src/component/checkbox/index.vue +++ b/package/component/src/component/checkbox/index.vue @@ -27,6 +27,7 @@ const props = withDefaults(defineProps(), { }); const checkboxGroup: any = inject("checkboxGroup", {}); +const checkboxGroupDisabled: boolean = inject("checkboxGroupDisabled", false); const isGroup = computed(() => { return ( @@ -92,7 +93,7 @@ const setArrayModelValue = function (checked: any) { }; const handleClick = function () { - if (!props.disabled) { + if (!props.disabled&&!checkboxGroupDisabled) { isChecked.value = !isChecked.value; } }; @@ -104,7 +105,7 @@ const handleClick = function () {
(), { modelValue: () => [], + disabled:false }); const emit = defineEmits(["update:modelValue", "change"]); @@ -21,7 +23,7 @@ const emit = defineEmits(["update:modelValue", "change"]); const modelValue = ref(props.modelValue); provide("checkboxGroup", { name: "LayCheckboxGroup", modelValue: modelValue }); - +provide("checkboxGroupDisabled",props.disabled) watch( () => modelValue, (val) => { @@ -35,10 +37,11 @@ watch( () => props.modelValue, (val) => (modelValue.value = val) ); + diff --git a/package/document-component/src/document/zh-CN/components/checkbox.md b/package/document-component/src/document/zh-CN/components/checkbox.md index 24c5f983..13031de0 100644 --- a/package/document-component/src/document/zh-CN/components/checkbox.md +++ b/package/document-component/src/document/zh-CN/components/checkbox.md @@ -133,6 +133,12 @@ export default {