HarmonyOS 组件enable和stateStyles组合不生效?

组件enable和stateStyles组合 enable设置true还是false。展示的都是false的样式

@Entry
@Component
struct Index {
  @State message: string = 'Hello World';

  build() {
    RelativeContainer() {
      Text(this.message)
        .id('HelloWorld')
        .fontSize(20)
        .fontWeight(FontWeight.Bold)
        .alignRules({
          center: { anchor: '__container__', align: VerticalAlign.Center },
          middle: { anchor: '__container__', align: HorizontalAlign.Center }
        })
        .height(48)
        .borderRadius(8)
        .borderWidth(0.5)
        .textAlign(TextAlign.Center)
        .stateStyles({
          normal: {
            .borderColor(Color.Black)
            .fontColor(Color.Black)
          },
          disabled: {
            .borderColor("#FFD4A3")
            .fontColor("#FFD4A3")
          },

        }).enabled(true)
    }
    .height('100%')
    .width('100%')
  }
}
阅读 538
1 个回答