1# arkui子系统ChangeLog 2 3## cl.arkui.1 getInspectorTree接口返回值从string修改为Object。 4 5**变更影响** 6 73.2.10.7之前使用getInspectorTree接口的代码需要适配 8 9**关键的接口/组件变更** 10 11getInspectorTree接口返回值从string修改为Object 12 13**适配指导** 14 15将getInspectorTree返回值作为string使用的代码需要修改,比如以下示例代码: 16 17```typescript 18console.info(getInspectorTree()) 19``` 20 21需要修改成 22 23```typescript 24console.info(JSON.stringify(getInspectorTree())) 25``` 26 27## cl.arkui.2 废弃GridItem的forceRebuild属性 28 29**变更影响** 30 31无,该属性无作用 32 33**关键的接口/组件变更** 34 35GridItem的forceRebuild属性废弃 36 37**适配指导** 38 39如有使用可以直接删除,不影响GridItem功能 40 41## cl.arkui.3 Plugin模块接口变更 42 43 44### 1. arkui子系统Plugin模块 `PluginComponentTemplate` 接口存在变更: 45 46ability命名无法准确表达对应参数的语义,修改为bundleName。 47 48开发者需要根据以下说明对应用进行适配。 49 50 51 52**变更影响** 53 54基于此前版本开发的应用,需适配变更接口,变更前的接口已经不能正常使用,会在编译过程中报错。 55 56 57 58**关键的接口/组件变更** 59 60- 涉及接口 61 62 interface PluginComponentTemplate { 63 source: string; 64 bundleName: string; 65 } 66 67 interface PluginComponentInterface { 68 (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; 69} 70 71- 变更前: 72 73```js 74 interface PluginComponentTemplate { source: string; ability: string; } 75 interface PluginComponentInterface { 76 (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; 77 } 78``` 79 80- 变更后: 81 82```js 83 interface PluginComponentTemplate { source: string; bundleName: string; } 84 interface PluginComponentInterface { 85 (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute; 86 } 87``` 88 89**适配指导** 90 91使用变更后的接口,示例代码如下: 92 93- 变更前: 94```js 95PluginComponent({ 96 template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, 97 data: { 'countDownStartValue': 'new countDownStartValue' } 98}).size({ width: 500, height: 100 }) 99``` 100 101- 变更后: 102```js 103PluginComponent({ 104 template: { source: 'plugincomponent1', bundleName: 'com.example.plugin' }, 105 data: { 'countDownStartValue': 'new countDownStartValue' } 106}).size({ width: 500, height: 100 }) 107``` 108 109### 2. arkui子系统Plugin模块 `pluginComponentManager` 接口存在变更: 110 111want命名无法准确表达对应参数的语义,修改为target。 112 113开发者需要根据以下说明对应用进行适配。 114 115 116 117**变更影响** 118 119基于此前版本开发的应用,需适配变更接口。变更前的接口会出现告警,虽然可以通过编译,但是已经不能正常使用其功能。 120 121 122 123**关键的接口/组件变更** 124 125- 涉及接口 126 127 interface PushParameterForStage { 128 owner: Want; 129 target: Want; 130 name: string; 131 data: KVObject; 132 extraData: KVObject; 133 jsonPath?: string; 134 } 135 136 function push(param: PushParameterForStage, callback: AsyncCallback<void>): void; 137 138 interface RequestParameterForStage { 139 owner: Want; 140 target: Want; 141 name: string; 142 data: KVObject; 143 jsonPath?: string; 144 } 145 146 function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void; 147 148- 变更前: 149 150```js 151 interface PushParameterForStage { 152 owner: Want; 153 want: Want; 154 name: string; 155 data: KVObject; 156 extraData: KVObject; 157 jsonPath?: string; 158 } 159 160 function push(param: PushParameterForStage, callback: AsyncCallback<void>): void; 161 162 interface RequestParameterForStage { 163 owner: Want; 164 want: Want; 165 name: string; 166 data: KVObject; 167 jsonPath?: string; 168 } 169 170 function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void; 171``` 172 173- 变更后: 174 175```js 176 interface PushParameterForStage { 177 owner: Want; 178 target: Want; 179 name: string; 180 data: KVObject; 181 extraData: KVObject; 182 jsonPath?: string; 183 } 184 185 function push(param: PushParameterForStage, callback: AsyncCallback<void>): void; 186 187 interface RequestParameterForStage { 188 owner: Want; 189 target: Want; 190 name: string; 191 data: KVObject; 192 jsonPath?: string; 193 } 194 195 function request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void; 196``` 197 198**适配指导** 199 200使用变更后的接口,示例代码如下: 201 202- 变更前: 203```js 204import pluginComponentManager from '@ohos.pluginComponent' 205 206pluginComponentManager.push({ 207 owner:{ 208 bundleName:"com.example.provider", 209 abilityName:"com.example.provider.MainAbility" 210 }, 211 want: { 212 bundleName: "com.example.provider", 213 abilityName: "com.example.provider.MainAbility", 214 }, 215 name: "ets/pages/plugin2.js", 216 data: { 217 "js": "ets/pages/plugin.js", 218 "key_1": 1111, 219 }, 220 extraData: { 221 "extra_str": "this is push event" 222 }, 223 jsonPath: "", 224 }, 225 (err, data) => { 226 console.log("push_callback:err: " ,JSON.stringify(err)); 227 console.log("push_callback:data: " , JSON.stringify(data)); 228 console.log("push_callback: push ok!"); 229 } 230) 231 232pluginComponentManager.request({ 233 owner:{ 234 bundleName:"com.example.provider", 235 abilityName:"com.example.provider.MainAbility" 236 }, 237 want: { 238 bundleName: "com.example.provider", 239 abilityName: "ets/pages/plugin2.js", 240 }, 241 name: "plugintemplate", 242 data: { 243 "key_1": " myapplication plugin component test", 244 "key_2": 123456 245 }, 246 jsonPath: "", 247}, 248 (err, data) => { 249 console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) 250 console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) 251 } 252) 253``` 254 255- 变更后: 256```js 257import pluginComponentManager from '@ohos.pluginComponent' 258 259pluginComponentManager.push({ 260 owner:{ 261 bundleName:"com.example.provider", 262 abilityName:"com.example.provider.MainAbility" 263 }, 264 target: { 265 bundleName: "com.example.provider", 266 abilityName: "com.example.provider.MainAbility", 267 }, 268 name: "ets/pages/plugin2.js", 269 data: { 270 "js": "ets/pages/plugin.js", 271 "key_1": 1111, 272 }, 273 extraData: { 274 "extra_str": "this is push event" 275 }, 276 jsonPath: "", 277 }, 278 (err, data) => { 279 console.log("push_callback:err: " ,JSON.stringify(err)); 280 console.log("push_callback:data: " , JSON.stringify(data)); 281 console.log("push_callback: push ok!"); 282 } 283) 284 285pluginComponentManager.request({ 286 owner:{ 287 bundleName:"com.example.provider", 288 abilityName:"com.example.provider.MainAbility" 289 }, 290 target: { 291 bundleName: "com.example.provider", 292 abilityName: "ets/pages/plugin2.js", 293 }, 294 name: "plugintemplate", 295 data: { 296 "key_1": " myapplication plugin component test", 297 "key_2": 123456 298 }, 299 jsonPath: "", 300}, 301 (err, data) => { 302 console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) 303 console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) 304 } 305) 306``` 307