还原cachedValue

This commit is contained in:
ascend13 2023-09-20 10:56:29 +08:00
parent ac18ca98d7
commit 8049b439ba
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ export class ContextMenu extends React.Component<
}
componentDidMount() {
document.body.addEventListener('click', this.handleOutClick);
document.body.addEventListener('click', this.handleOutClick, true);
document.addEventListener('keydown', this.handleKeyDown);
}

View File

@ -18,7 +18,7 @@ addSchemaFilter(function (schema: Schema, renderer, props?: any) {
if (!isObject(value)) {
return [];
}
if (isEqual(value, this?.cachedValue)) {
if (isEqual(value, this.cachedValue)) {
return this.cachedValueArray;
}
const arr: Array<any> = [];
@ -56,8 +56,8 @@ addSchemaFilter(function (schema: Schema, renderer, props?: any) {
obj[key] = value;
});
this && (this.cachedValue = obj);
this && (this.cachedValueArray = value);
this.cachedValue = obj;
this.cachedValueArray = value;
return obj;
},
items: [