未验证 提交 4af3e858 编写于 作者: O openharmony_ci 提交者: Gitee

!18311 示例代码检查与接口一致性3.2release

Merge pull request !18311 from 田雨/3.2rel0517
...@@ -181,14 +181,13 @@ OnRequestEventCallback = (source: Want, name: string, data: KVObject) => Request ...@@ -181,14 +181,13 @@ OnRequestEventCallback = (source: Want, name: string, data: KVObject) => Request
**示例:** **示例:**
```js ```js
function onRequestListener(source, name, data) function onRequestListener(source, name, data) {
{
console.error("onRequestListener"); console.error("onRequestListener");
console.log("onRequestListener source=" + JSON.stringify(source)); console.log("onRequestListener source=" + JSON.stringify(source));
console.log("onRequestListener name=" + name); console.log("onRequestListener name=" + name);
console.log("onRequestListener data=" + JSON.stringify(data)); console.log("onRequestListener data=" + JSON.stringify(data));
return {template:"ets/pages/plugin.js", data:data}; return { template: "ets/pages/plugin.js", data: data };
} }
``` ```
...@@ -210,7 +209,7 @@ push(param: PushParameters , callback: AsyncCallback<void>): void ...@@ -210,7 +209,7 @@ push(param: PushParameters , callback: AsyncCallback<void>): void
```js ```js
pluginComponentManager.push( pluginComponentManager.push(
{ {
want: { want: {
bundleName: "com.example.provider", bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility", abilityName: "com.example.provider.MainAbility",
...@@ -252,9 +251,9 @@ push(param: PushParameterForStage, callback: AsyncCallback<void>): void ...@@ -252,9 +251,9 @@ push(param: PushParameterForStage, callback: AsyncCallback<void>): void
```js ```js
pluginComponentManager.push( pluginComponentManager.push(
{ {
owner:{ owner: {
bundleName:"com.example.provider", bundleName: "com.example.provider",
abilityName:"com.example.provider.MainAbility" abilityName: "com.example.provider.MainAbility"
}, },
target: { target: {
bundleName: "com.example.provider", bundleName: "com.example.provider",
...@@ -271,8 +270,8 @@ pluginComponentManager.push( ...@@ -271,8 +270,8 @@ pluginComponentManager.push(
jsonPath: "", jsonPath: "",
}, },
(err, data) => { (err, data) => {
console.log("push_callback:err: " ,JSON.stringify(err)); console.log("push_callback:err: ", JSON.stringify(err));
console.log("push_callback:data: " , JSON.stringify(data)); console.log("push_callback:data: ", JSON.stringify(data));
console.log("push_callback: push ok!"); console.log("push_callback: push ok!");
} }
) )
...@@ -343,9 +342,9 @@ request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallb ...@@ -343,9 +342,9 @@ request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallb
```js ```js
pluginComponentManager.request( pluginComponentManager.request(
{ {
owner:{ owner: {
bundleName:"com.example.provider", bundleName: "com.example.provider",
abilityName:"com.example.provider.MainAbility" abilityName: "com.example.provider.MainAbility"
}, },
target: { target: {
bundleName: "com.example.provider", bundleName: "com.example.provider",
...@@ -381,8 +380,8 @@ on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback ): ...@@ -381,8 +380,8 @@ on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback ):
**示例:** **示例:**
```js ```js
pluginComponentManager.on("push", onPushListener) pluginComponentManager.on("push", onPushListener)
pluginComponentManager.on("request", onRequestListener) pluginComponentManager.on("request", onRequestListener)
``` ```
## external.json文件说明 ## external.json文件说明
...@@ -396,3 +395,5 @@ external.json文件由开发者创建。external.json中以键值对形式存放 ...@@ -396,3 +395,5 @@ external.json文件由开发者创建。external.json中以键值对形式存放
"PluginProviderExample": "ets/pages/PluginProviderExample.js", "PluginProviderExample": "ets/pages/PluginProviderExample.js",
"plugintemplate2": "ets/pages/plugintemplate2.js" "plugintemplate2": "ets/pages/plugintemplate2.js"
} }
```
\ No newline at end of file
...@@ -320,7 +320,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode): Promise<void> ...@@ -320,7 +320,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode): Promise<void>
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| --------- | ------- | | --------- | ------- |
| 100001 | if UI execution context not found, only throw in standard system. | | 100001 | if can not get the delegate, only throw in standard system. |
| 200002 | if the uri is not exist. | | 200002 | if the uri is not exist. |
**示例:** **示例:**
...@@ -362,7 +362,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback< ...@@ -362,7 +362,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback<
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| --------- | ------- | | --------- | ------- |
| 100001 | if can not get the delegate, only throw in standard system. | | 100001 | if UI execution context not found, only throw in standard system. |
| 200002 | if the uri is not exist. | | 200002 | if the uri is not exist. |
**示例:** **示例:**
...@@ -659,7 +659,7 @@ struct Second { ...@@ -659,7 +659,7 @@ struct Second {
private content: string = "这是第二页" private content: string = "这是第二页"
@State text: string = router.getParams()['text'] @State text: string = router.getParams()['text']
@State data: object = router.getParams()['data'] @State data: object = router.getParams()['data']
@State secondData : string = '' @State secondData: string = ''
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...@@ -668,13 +668,13 @@ struct Second { ...@@ -668,13 +668,13 @@ struct Second {
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
Text(this.text) Text(this.text)
.fontSize(30) .fontSize(30)
.onClick(()=>{ .onClick(() => {
this.secondData = (this.data.['array'][1]).toString() this.secondData = (this.data.['array'][1]).toString()
}) })
.margin({top:20}) .margin({ top: 20 })
Text(`第一页传来的数值:${this.secondData}`) Text(`第一页传来的数值:${this.secondData}`)
.fontSize(20) .fontSize(20)
.margin({top:20}) .margin({ top: 20 })
.backgroundColor('red') .backgroundColor('red')
} }
.width('100%') .width('100%')
......
...@@ -341,8 +341,8 @@ export default { ...@@ -341,8 +341,8 @@ export default {
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| ------ | -------- | ---- | ------------------------------------------------------------ | | ------ | -------- | ---- | ------------------------------------------------------------ |
| uri | string | 是 | 目标页面的uri,可以是以下的两种格式:<br/>1. 页面的绝对路径,由config.json文件中的页面列表提供。例如:<br/>- pages/index/index<br/> -pages/detail/detail<br/>2. 特定路径。如果URI为斜杠(/),则显示主页。 | | uri<sup>7+</sup> | string | 是 | 目标页面的uri,可以是以下的两种格式:<br/>1. 页面的绝对路径,由config.json文件中的页面列表提供。例如:<br/>- pages/index/index<br/> -pages/detail/detail<br/>2. 特定路径。如果URI为斜杠(/),则显示主页。 |
| params | object | 否 | 表示路由跳转时要同时传递到目标页面的数据。跳转到目标页面后,使用router.getParams()获取传递的参数,此外,在类web范式中,参数也可以在页面中直接使用,如this.keyValue(keyValue为跳转时params参数中的key值),如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 | | params<sup>7+</sup> | object | 否 | 表示路由跳转时要同时传递到目标页面的数据。跳转到目标页面后,使用router.getParams()获取传递的参数,此外,在类web范式中,参数也可以在页面中直接使用,如this.keyValue(keyValue为跳转时params参数中的key值),如果目标页面中已有该字段,则其值会被传入的字段值覆盖。 |
## BackRouterOptions ## BackRouterOptions
...@@ -353,8 +353,8 @@ export default { ...@@ -353,8 +353,8 @@ export default {
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| ------ | -------- | ---- | ------------------------------------------------------------ | | ------ | -------- | ---- | ------------------------------------------------------------ |
| uri | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。 <br>**系统能力:** SystemCapability.ArkUI.ArkUI.Full | | uri<sup>7+</sup> | string | 否 | 返回到指定uri的界面,如果页面栈上没有uri页面,则不响应该情况。如果uri未设置,则返回上一页。 <br>**系统能力:** SystemCapability.ArkUI.ArkUI.Full |
| params | object | 否 | 跳转时要同时传递到目标页面的数据。 <br>**系统能力:** SystemCapability.ArkUI.ArkUI.Lite | | params<sup>7+</sup> | object | 否 | 跳转时要同时传递到目标页面的数据。 <br>**系统能力:** SystemCapability.ArkUI.ArkUI.Lite |
## RouterState ## RouterState
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册