From 89186a48b389fb73c1a12728445cb49292169fc6 Mon Sep 17 00:00:00 2001 From: liweifeng Date: Mon, 6 Jun 2022 14:10:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9ErequestPublishForm=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liweifeng Change-Id: I887cc947cda62663692a54e0655554e380fcdd8f --- .../reference/apis/js-apis-formprovider.md | 115 +++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-formprovider.md b/zh-cn/application-dev/reference/apis/js-apis-formprovider.md index 08ca66d24c..d54b0a6458 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formprovider.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formprovider.md @@ -231,4 +231,117 @@ formProvider.getFormsInfo(filter).then((data) => { }).catch((error) => { console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); }); -``` \ No newline at end of file +``` + +## requestPublishForm9+ + +requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<string>): <void>; + +请求发布一张卡片到使用方。 + +**系统能力:** + +SystemCapability.Ability.Form + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | +| want | [Want](js-apis-application-Want.md) | 是 | abilityName: 目标卡片ability
parameters:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | +| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 用于创建卡片的数据 | +| callback | AsyncCallback<string> | 是 | callback形式返回卡片标识 | + +**示例:** + + ```js + import formBindingData from '@ohos.application.formBindingData'; + var want = { + abilityName: "FormAbility", + parameters: { + "ohos.extra.param.key.form_dimension": 2, + "ohos.extra.param.key.form_name": "widget", + "ohos.extra.param.key.module_name": "entry" + } + }; + let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); + formProvider.requestPublishForm(want, obj, (error, data) => { + if (error.code) { + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + } else { + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); + } + }); + ``` + +## requestPublishForm9+ + +requestPublishForm(want: Want, callback: AsyncCallback<string>): <void>; + +请求发布一张卡片到使用方。 + +**系统能力:** + +SystemCapability.Ability.Form + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | ------------------------------------------------------------ | +| want | [Want](js-apis-application-Want.md) | 是 | abilityName: 目标卡片ability
parameters:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | +| callback | AsyncCallback<string> | 是 | callback形式返回卡片标识 | + +**示例:** + + ```js + var want = { + abilityName: "FormAbility", + parameters: { + "ohos.extra.param.key.form_dimension": 2, + "ohos.extra.param.key.form_name": "widget", + "ohos.extra.param.key.module_name": "entry" + } + }; + formProvider.requestPublishForm(want, (error, data) => { + if (error.code) { + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + } else { + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); + } + }); + ``` + +## requestPublishForm9+ + +requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData): Promise<string>; + +请求发布一张卡片到使用方。 + +**系统能力:** + +SystemCapability.Ability.Form + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| want | [Want](js-apis-application-Want.md) | 是 | abilityName: 目标卡片ability
parameters:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | +| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 否 | 用于创建卡片的数据 | +| callback | AsyncCallback<string> | 是 | callback形式返回卡片标识 | + +**示例:** + + ```js + var want = { + abilityName: "FormAbility", + parameters: { + "ohos.extra.param.key.form_dimension": 2, + "ohos.extra.param.key.form_name": "widget", + "ohos.extra.param.key.module_name": "entry" + } + }; + formProvider.requestPublishForm(want).then((data) => { + console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data)); + }).catch((error) => { + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + }); + ``` -- GitLab