diff --git a/components/checkbox/Group.jsx b/components/checkbox/Group.jsx index 4e2e8c989..fe993ef01 100644 --- a/components/checkbox/Group.jsx +++ b/components/checkbox/Group.jsx @@ -44,7 +44,7 @@ export default { }, methods: { getOptions () { - const { options } = this.$props + const { options, $scopedSlots } = this return options.map(option => { if (typeof option === 'string') { return { @@ -52,7 +52,11 @@ export default { value: option, } } - return option + let label = option.label + if (label === undefined && $scopedSlots.label) { + label = $scopedSlots.label(option) + } + return { ...option, label } }) }, toggleOption (option) { diff --git a/components/checkbox/demo/group.md b/components/checkbox/demo/group.md index eb6c696af..19b3b5498 100644 --- a/components/checkbox/demo/group.md +++ b/components/checkbox/demo/group.md @@ -17,7 +17,9 @@ Generate a group of checkboxes from an array

- + + {{value}} +