• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ArkUI子系统Changelog
2
3## cl.arkui.1 废弃gridSpan和gridOffset属性
4**访问级别**
5
6公开接口
7
8**废弃原因**
9
10gridSpan和gridOffset属性仅设置在gridContaier的子组件上有效,gridContainer组件已废弃。
11
12**废弃影响**
13
14该变更为接口废弃,开发者需使用替代接口。
15
16**废弃发生版本**
17
18从OpenHarmony SDK 5.0.0.56开始。
19
20**废弃的接口/组件**
21
22|           废弃接口            |                  替代接口                  |
23| :---------------------------: | :----------------------------------------: |
24|  gridSpan(value: number): T;  |  GridCol(option?: GridColOptions)中的span  |
25| gridOffset(value: number): T; | GridCol(option?: GridColOptions)中的offset |
26
27**适配指导**
28
29废弃前使用gridSpan、gridOffset属性的栅格。
30
31```ts
32// xxx.ets
33@Entry
34@Component
35struct GridContainerExample1 {
36  build() {
37    Column() {
38      Text('gridSpan,gridOffset').fontSize(15).fontColor(0xCCCCCC).width('90%')
39      GridContainer() {
40        Row() {
41          Row() {
42            Text('Left').fontSize(25)
43          }
44          .gridSpan(1)
45          .height("100%")
46          .backgroundColor(0x66bbb2cb)
47
48          Row() {
49            Text('Center').fontSize(25)
50          }
51          .gridSpan(2)
52          .gridOffset(1)
53          .height("100%")
54          .backgroundColor(0x66b6c5d1)
55
56          Row() {
57            Text('Right').fontSize(25)
58          }
59          .gridSpan(1)
60          .gridOffset(3)
61          .height("100%")
62          .backgroundColor(0x66bbb2cb)
63        }.height(200)
64      }
65    }
66  }
67}
68```
69
70使用GridRow容器,并且子组件为GridCol。GridCol构造中设置span(对应废弃的gridSpan)、offset(对应废弃的gridOffset)属性的栅格。
71```ts
72// xxx.ets
73@Entry
74@Component
75struct GridRowExample {
76  @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]
77  @State currentBp: string = 'unknown'
78
79  build() {
80    Column() {
81      GridRow({
82        columns: 5,
83        gutter: { x: 5, y: 10 },
84        breakpoints: { value: ["400vp", "600vp", "800vp"],
85          reference: BreakpointsReference.WindowSize },
86        direction: GridRowDirection.Row
87      }) {
88          GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 }, offset: 0, order: 0 }) {
89            Text('Left').fontSize(25)
90          }.borderColor(color).borderWidth(2)
91          GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 }, offset: 1, order: 0 }) {
92            TText('Center').fontSize(25)
93          }.borderColor(color).borderWidth(2)
94          GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 }, offset: 2, order: 0 }) {
95             Text('Right').fontSize(25)
96          }.borderColor(color).borderWidth(2)
97      }.width("100%").height("100%")
98      .onBreakpointChange((breakpoint) => {
99        this.currentBp = breakpoint
100      })
101    }.width('80%').margin({ left: 10, top: 5, bottom: 5 }).height(200)
102    .border({ color: '#880606', width: 2 })
103  }
104}
105```
106
107## cl.arkui.2 Chip与ChipGroup组件布局重构
108
109**访问级别**
110
111公开接口
112
113**变更原因**
114
115原来的布局逻辑未考虑像素取整情况,导致部分界面显示异常。因此发起布局重构,重构后会因为像素取整导致组件的整体宽度可能偏差1像素单位。
116
117**变更影响**
118
119此变更不涉及应用适配。
120
121| 变更前                                                                     | 变更后                                                                 |
122| -------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
123| 组件布局过程中不会进行像素取整 <br>![chip_before](figures/chip_before.PNG) | 组件布局过程中会进行像素取整<br>![chip_before](figures/chip_after.PNG) |
124
125变更后可能影响自动化UI测试结果,产生像素级偏差。
126
127**起始API Level**
128
129API 12
130
131**变更发生版本**
132
133从OpenHarmony SDK 5.0.0.56开始。
134
135**变更的接口/组件**
136
137Chip与ChipGroup组件。
138
139**适配指导**
140
141默认效果变更,无需适配,但应注意变更后的默认效果是否符合开发者预期,如不符合则应自定义修改效果控制变量以达到预期。
142
143## cl.arkui.3 router转场动画过程中,启用事件响应,并增加默认转场动画的拖尾效果
144
145**访问级别**
146
147公开接口
148
149**变更原因**
150
151router默认转场动效无拖尾效果,导致应用动画最后一帧出现跳变,影响用户体验。变更后,router支持转场动画打断和接续,在动画转场过程中可响应事件。
152
153**变更影响**
154
155转场过程中可响应点击事件涉及应用适配。
156
157动画时长变更不涉及应用适配。
158
159运行以下示例:
160
161```js
162@Entry
163@Component
164struct TestPage {
165  isAnimation: boolean = false;
166
167  build() {
168    Row() {
169      Column() {
170        TextInput().id('textInput')
171      }
172      .width('100%')
173    }
174    .height('100%')
175    .onAppear(() => {
176      if (this.isAnimation) {
177        setTimeout(() => {
178          focusControl.requestFocus('textInput');
179        }, 5)
180      } else {
181        setTimeout(() => {
182          focusControl.requestFocus('textInput')
183        }, 500)
184      }
185    })
186  }
187}
188```
189
190变更前:
191
192- router转场过程中请求焦点,必须要按照示例代码的形式启动定时器延迟到动画结束才能请求成功。router转场过程中无法点击、侧滑,必须在动画结束后才能操作对应页面。
193
194- router转场时间为400ms。
195
196变更后:
197
198- 页面跳转后即可请求焦点,无需添加定时器延迟操作请求。
199
200- router转场时间变成600ms。
201
202**起始API Level**
203
204API Version 8
205
206**发生变更版本**
207
208从OpenHarmony SDK 5.0.0.56开始。
209
210**变更的接口/组件**
211
212router.pushUrlrouter.backrouter.pushNamedRoute
213
214**适配指导**
215
2161. 动画时长变更,无需适配。
217
2182. 开发者在多输入框页面中使用定时器请求焦点,用户在动效转场过程中点击输入组件后,出现焦点跳变。针对该问题,在目标跳转页面中直接请求对应的焦点即可,可参照如下示例代码:
219```js
220@Entry
221@Component
222struct TestPage {
223
224  build() {
225    Row() {
226      Column() {
227        TextInput().id('textInput')
228      }
229      .width('100%')
230    }
231    .height('100%')
232    .onAppear(() => {
233      focusControl.requestFocus('textInput');
234    })
235  }
236}
237```
238
239## cl.arkui.4 RichEditor(富文本)在光标处于文本起始位置情况时向前删除空文本onWillChange回调变更
240
241**访问级别**
242
243公开接口
244
245**变更原因**
246
247RichEditorController构造的富文本:光标位于文本起始位置时向前删除,触发onWillChange回调范围是[-1, -1],不符合接口定义。
248RichEditorStyledStringController构造的富文本:光标位于文本起始位置时向前删除,触发onWillChange回调范围是[0, 1],不符合接口定义。
249
250**变更影响**
251
252该变更为不兼容变更。
253
254| 组件                                | 变更前                                  | 变更后                                               |
255|------------------------------------ | ---------------------------------------|---------------------------------------|
256|RichEditorController构造的富文本| 光标位于文本起始位置时向前删除,触发onWillChange回调范围是[-1, -1]。 | 光标位于文本起始位置时向前删除,触发onWillChange回调范围是[0, 0]。|
257|RichEditorStyledStringController构造的富文本| 光标位于文本起始位置时向前删除,触发onWillChange回调范围是[0, 1]。| 光标位于文本起始位置时向前删除,触发onWillChange回调范围是[0, 0]。|
258
259**起始API Level**
260
261API 12。
262
263**变更发生版本**
264
265从OpenHarmony SDK 5.0.0.56开始。
266
267**变更的接口/组件**
268
269RichEditor
270
271**适配指导**
272
273默认行为变更,无需适配,但应注意变更后的行为是否对整体应用逻辑产生影响。