refactor: 简化 prop.items 的生成逻辑

This commit is contained in:
lihao.ylh 2021-12-29 19:22:07 +08:00 committed by lianjie.lj
parent 93f7de0309
commit 2c14e7515b

View File

@ -379,7 +379,7 @@ export class Prop implements IPropParent {
/** /**
* items maps * items maps
*/ */
@computed private get items(): Prop[] | null { private get items(): Prop[] | null {
if (this._items) return this._items; if (this._items) return this._items;
return runInAction(() => { return runInAction(() => {
let items: Prop[] | null = null; let items: Prop[] | null = null;
@ -617,9 +617,11 @@ export class Prop implements IPropParent {
if (this._items) { if (this._items) {
this._items.forEach((item) => item.purge()); this._items.forEach((item) => item.purge());
} }
this._items = null;
this._maps = null; this._maps = null;
if (this._slotNode && this._slotNode.slotFor === this) { if (this._slotNode && this._slotNode.slotFor === this) {
this._slotNode.remove(); this._slotNode.remove();
this._slotNode = undefined;
} }
} }