HarmonyOS NodeContainer使用方式?

export struct RoomNodeRoot {
  @State nodeController: NodeController | undefined = undefined
  aboutToAppear(): void {
    this.nodeController = new XNodeController(true, this.roomsPageApi!!, this.nodeState)
  }

  build() {
    Stack() {
      if (this.nodeController != undefined) {
        NodeContainer(this.nodeController).width('100%').height('100%').backgroundColor(Color.Transparent)
      }
    }
  }
}

上面这段代码使用的场景是:替换部分功能面板的UI,现在的实现方案是通过替换nodeController实例来做到面板替换,这么实现会不会什么功能问题?

阅读 526
1 个回答

替换nodeController并不会有明显的性能问题,也可以通过Navigation来实现UI局部替换。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进