鸿蒙开发:wrapBuilder来封装全局@Builder
原创
前言本文代码案例基于Api13。Builder装饰器,可以把build函数中的组件代码,单独的抽取出来,虽然简化了build函数,实现了组件之间的复用,但是代码还是在整个UI视图内,如下案例所示:EntryComponentstructIndex{BuilderTextView(text:string){Text(text)}build(){Column(){this.TextView("测试数据1")this.TextView("测试数据2")}.height('100%').width('100%').justifyContent(FlexAlign.Center)}}只能说,在同一个UI视...