fix: modify metadata init logic

pull/880/head
Li 2023-02-23 12:15:43 +08:00
parent 816feb9937
commit e50a5e4fd1
1 changed files with 14 additions and 13 deletions

View File

@ -100,22 +100,23 @@ const handleProcessCustomAnnotations = () => {
}) })
.filter((item) => item) as { key: string; value: string }[]; .filter((item) => item) as { key: string; value: string }[];
annotations.value = Object.entries(props.value || {}) annotations.value = formSchemas
.map(([key, value]) => { .map((item) => {
const fromThemeSpec = formSchemas.some((item) => { if (typeof item === "object" && "$formkit" in item) {
if (typeof item === "object" && "$formkit" in item) { if (props.value && item.name in props.value) {
return item.name === key; return {
key: item.name,
value: props.value[item.name],
};
} else {
return {
key: item.name,
value: item.value,
};
} }
return false;
});
if (fromThemeSpec) {
return {
key,
value,
};
} }
}) })
.filter((item) => item) .filter(Boolean)
.reduce((acc, cur) => { .reduce((acc, cur) => {
if (cur) { if (cur) {
acc[cur.key] = cur.value; acc[cur.key] = cur.value;