Skip to content

Commit

Permalink
fix(element): fix vue list key not update correctly (#2490)
Browse files Browse the repository at this point in the history
  • Loading branch information
muuyao authored Nov 24, 2021
1 parent b6dea22 commit c0a37fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/element/src/array-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ const useKey = (schema: Schema) => {
if (!keyMap.has(record)) {
keyMap.set(record, uid())
}
return keyMap.get(record)
return `${keyMap.get(record)}-${index}`
}

if (!keyMap[index]) {
keyMap[index] = uid()
}

return keyMap[index]
return `${keyMap[index]}-${index}`
},
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/element/src/array-collapse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const ArrayCollapseInner = observer(
default: 5,
},
},
setup(props, { attrs, listeners }) {
setup(props, { attrs }) {
const fieldRef = useField<ArrayField>()
const schemaRef = useFieldSchema()

Expand Down Expand Up @@ -279,7 +279,6 @@ export const ArrayCollapseInner = observer(
on: {
change: (keys: number[] | number) => {
activeKeys.value = keys
listeners?.change?.(keys)
},
},
},
Expand Down

0 comments on commit c0a37fe

Please sign in to comment.