From 3d1b336dac1ebf3fec2b58cf3e8b776de948cefa Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 14 May 2020 15:07:34 +0800 Subject: [PATCH] feat:Add removeChild API for GroupView --- doric-js/src/ui/view.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doric-js/src/ui/view.ts b/doric-js/src/ui/view.ts index d307289c..82352749 100644 --- a/doric-js/src/ui/view.ts +++ b/doric-js/src/ui/view.ts @@ -378,5 +378,15 @@ export abstract class Group extends Superview { addChild(view: View) { this.children.push(view) } + + removeChild(view: View) { + const ret = this.children.filter(e => e !== view) + this.children.length = 0 + ret.forEach(e => this.addChild(e)) + } + + removeAllChildren() { + this.children.length = 0 + } }