• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)
2
3### Added Validity Verification for Color Values in Color.json
4
5Validity verification is added for color values in the **color.json** file. The verification rules are as follows:
6
7- The hexadecimal color code is used in any of the following formats:
8    - #rgb: red(0-f) green(0-f) blue(0-f)
9    - #argb: transparency(0-f) red(0-f) green(0-f) blue(0-f)
10    - #rrggbb: red(00-ff) green(00-ff) blue(00-ff)
11    - #aarrggbb: transparency(00-ff) red(00-ff) green(00-ff) blue(00-ff)
12- The dollar sign ($) is used to reference resources defined in the application. The format is as follows:
13    - $color:xxx
14
15**Change Impacts**
16
17If the verification rules are not met, an error is reported during compilation.
18
19**Key API/Component Changes**
20
21None
22
23### Restrictions on Declaring Multiple Data Types of State Variables
24
25If 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.
26
27Example:
28
29```ts
30@Entry
31@Component
32struct Index {
33  // Incorrect: @State message: string | Resource = 'Hello World'
34  @State message: string = 'Hello World'
35
36  build() {
37    Row() {
38      Column() {
39        Text(`${ this.message }`)
40          .fontSize(50)
41          .fontWeight(FontWeight.Bold)
42      }
43      .width('100%')
44    }
45    .height('100%')
46  }
47}
48```
49
50**Change Impacts**
51
52When the defined state variable type contains both the simple data types and references, an error is reported during compilation.
53
54**Key API/Component Changes**
55
56If 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.
57