From afc1b84ed0f0c44c4b5466f161e3480a6a28eecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=93=E4=B8=9A=E9=80=AE=E8=99=BE=E6=88=B7aa?= <30494925+waldonUB@users.noreply.github.com> Date: Thu, 15 Jun 2023 11:11:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8checkbox=20label=20slot=20supp?= =?UTF-8?q?ort=20use=20option=20label=20(#6642)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: 📃change the default setting of "treeNodeFilterProp" from "value" to "label" * revert: ↩revert this config and create another pr to commit * feat: ✨checkbox label slot support use option label * test: 🧪update checkbox *.snap file --------- Co-authored-by: tangjinzhou <415800467@qq.com> --- components/checkbox/Group.tsx | 2 +- .../checkbox/__tests__/__snapshots__/demo.test.js.snap | 2 +- components/checkbox/demo/group.vue | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/checkbox/Group.tsx b/components/checkbox/Group.tsx index 6b89fe12d..57fb871ba 100644 --- a/components/checkbox/Group.tsx +++ b/components/checkbox/Group.tsx @@ -108,7 +108,7 @@ export default defineComponent({ onChange={option.onChange} class={`${groupPrefixCls.value}-item`} > - {option.label === undefined ? slots.label?.(option) : option.label} + {slots.label !== undefined ? slots.label?.(option) : option.label} )); } diff --git a/components/checkbox/__tests__/__snapshots__/demo.test.js.snap b/components/checkbox/__tests__/__snapshots__/demo.test.js.snap index 14411e75d..55fb8740d 100644 --- a/components/checkbox/__tests__/__snapshots__/demo.test.js.snap +++ b/components/checkbox/__tests__/__snapshots__/demo.test.js.snap @@ -39,7 +39,7 @@ exports[`renders ./components/checkbox/demo/group.vue correctly 1`] = `


-
+
`; exports[`renders ./components/checkbox/demo/layout.vue correctly 1`] = ` diff --git a/components/checkbox/demo/group.vue b/components/checkbox/demo/group.vue index 4543f49cc..fe737b83b 100644 --- a/components/checkbox/demo/group.vue +++ b/components/checkbox/demo/group.vue @@ -27,8 +27,8 @@ Generate a group of checkboxes from an array

- @@ -42,7 +42,7 @@ const options = [ { label: 'Orange', value: 'Orange' }, ]; const optionsWithDisabled = [ - { value: 'Apple' }, + { label: 'Apple', value: 'Apple' }, { label: 'Pear', value: 'Pear' }, { label: 'Orange', value: 'Orange', disabled: false }, ];