1.使用鸿蒙开发时@Preview出现问题——无法预览
A default value is required for a component attribute that can be initialized locally. (mandatory-default-value-for-local-initialization)
2.解决
2.1设置controller时定义为可选参数,即在controller后加?,如下:
private IntegralController?: CustomDialogController
this.IntegralController?.close()
2.2//错误
@BuilderParam leftElement: () => void
//正确
@Builder
leftElementBuild() {
}
@BuilderParam leftElement: () => void = this.leftElementBuild