harmony(鸿蒙)Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)

  • 2022-12-05
  • 浏览 (340)

Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)

Added Validity Verification for Color Values in Color.json

Validity verification is added for color values in the color.json file. The verification rules are as follows:

  • The hexadecimal color code is used in any of the following formats:
    • #rgb: red(0-f) green(0-f) blue(0-f)
    • #argb: transparency(0-f) red(0-f) green(0-f) blue(0-f)
    • #rrggbb: red(00-ff) green(00-ff) blue(00-ff)
    • #aarrggbb: transparency(00-ff) red(00-ff) green(00-ff) blue(00-ff)
  • The dollar sign ($) is used to reference resources defined in the application. The format is as follows:
    • $color:xxx

Change Impacts

If the verification rules are not met, an error is reported during compilation.

Key API/Component Changes

None

Restrictions on Declaring Multiple Data Types of State Variables

If a @State, @Provide, @Link, or @Consume decorated state variable supports multiple data types, they must be all simple data types or references at one time.

Example:

@Entry
@Component
struct Index {
  // Incorrect: @State message: string|Resource = 'Hello World'
  @State message: string = 'Hello World'

  build() {
    Row() {
      Column() {
        Text(`${ this.message }`)
          .fontSize(50)
          .fontWeight(FontWeight.Bold)
      }
      .width('100%')
    }
    .height('100%')
  }
}

Change Impacts

When the defined state variable type contains both the simple data types and references, an error is reported during compilation.

Key API/Component Changes

If the defined state variable type contains both the simple data types and references, change the type to one of them, as shown in the preceding sample code.

你可能感兴趣的鸿蒙文章

harmony(鸿蒙)Readme

harmony(鸿蒙)JS API Changes of the Ability Framework

harmony(鸿蒙)JS API Changes of the Accessibility Subsystem

harmony(鸿蒙)JS API Changes of the Account Subsystem

harmony(鸿蒙)JS API Changes of the ArkUI Development Framework

harmony(鸿蒙)JS API Changes of the Power Management Subsystem

harmony(鸿蒙)JS API Changes of the Bundle Management Framework

harmony(鸿蒙)JS API Changes of the Communication Subsystem

harmony(鸿蒙)JS API Changes of the Utils Subsystem

harmony(鸿蒙)JS API Changes of the DFX Subsystem

0  赞