mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 19:46:28 +00:00
fix: error TS2339: Property 'find' does not exist on type 'string | SchemaEnum<any>'
This commit is contained in:
parent
e6efc8dc57
commit
ed608fd795
@ -30,9 +30,10 @@ const toArr = (v) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getLabelFormatValue = (labelUiSchema: ISchema, value: any, isTag = false): any => {
|
export const getLabelFormatValue = (labelUiSchema: ISchema, value: any, isTag = false): any => {
|
||||||
if (Array.isArray(labelUiSchema?.enum) && value) {
|
const options = labelUiSchema?.enum;
|
||||||
|
if (Array.isArray(options) && value) {
|
||||||
const values = toArr(value).map((val) => {
|
const values = toArr(value).map((val) => {
|
||||||
const opt: any = labelUiSchema.enum.find((option: any) => option.value === val);
|
const opt: any = options.find((option: any) => option.value === val);
|
||||||
if (isTag) {
|
if (isTag) {
|
||||||
return React.createElement(Tag, { color: opt?.color }, opt?.label);
|
return React.createElement(Tag, { color: opt?.color }, opt?.label);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user