From 3f588b040646b79afffb775f1031397bc40dc7aa Mon Sep 17 00:00:00 2001 From: Xc <124118265@qq.com> Date: Thu, 25 Aug 2022 21:59:03 +0800 Subject: [PATCH] fix(components): [checkbox] label is object in group (#9271) * fix(components): [checkbox] label is object in group * fix(components): [checkbox] abbreviated code --- packages/components/checkbox/src/checkbox.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/components/checkbox/src/checkbox.ts b/packages/components/checkbox/src/checkbox.ts index dc2b08560a..9b45a1e109 100644 --- a/packages/components/checkbox/src/checkbox.ts +++ b/packages/components/checkbox/src/checkbox.ts @@ -1,4 +1,12 @@ -import { computed, getCurrentInstance, inject, nextTick, ref, watch } from 'vue' +import { + computed, + getCurrentInstance, + inject, + nextTick, + ref, + toRaw, + watch, +} from 'vue' import { toTypeString } from '@vue/shared' import { UPDATE_MODEL_EVENT } from '@element-plus/constants' import { @@ -182,7 +190,7 @@ const useCheckboxStatus = ( if (toTypeString(value) === '[object Boolean]') { return value } else if (Array.isArray(value)) { - return value.includes(props.label) + return value.map(toRaw).includes(props.label) } else if (value !== null && value !== undefined) { return value === props.trueLabel } else {