未验证 提交 80a55756 编写于 作者: O openharmony_ci 提交者: Gitee

!2928 Done! 2645:修复卡片文档描述问题以及新增卡片例子

Merge pull request !2928 from wusongqing/TR2645
...@@ -124,9 +124,8 @@ To create a widget in the stage model, you need to implement the lifecycle callb ...@@ -124,9 +124,8 @@ To create a widget in the stage model, you need to implement the lifecycle callb
// Delete widget data. // Delete widget data.
console.log('FormAbility onDestroy'); console.log('FormAbility onDestroy');
} }
onAcquireFormState(want) { onConfigurationUpdated(config) {
console.log('FormAbility onAcquireFormState'); console.log('FormAbility onConfigurationUpdated, config:' + JSON.stringify(config));
return formInfo.FormState.READY;
} }
} }
``` ```
...@@ -183,7 +182,7 @@ Configure the **module.json** file for the **Form** ability. ...@@ -183,7 +182,7 @@ Configure the **module.json** file for the **Form** ability.
| updateEnabled | Whether the widget can be updated periodically. Available values are as follows:<br>**true**: The widget can be updated periodically, depending on the update way you select, either at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** is preferentially recommended.<br>**false**: The widget cannot be updated periodically.| Boolean | No | | updateEnabled | Whether the widget can be updated periodically. Available values are as follows:<br>**true**: The widget can be updated periodically, depending on the update way you select, either at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** is preferentially recommended.<br>**false**: The widget cannot be updated periodically.| Boolean | No |
| scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute. | String | Yes (initial value: **0:0**) | | scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute. | String | Yes (initial value: **0:0**) |
| updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes.<br>If the value is **0**, this field does not take effect.<br>If the value is a positive integer ***N***, the interval is calculated by multiplying ***N*** and 30 minutes.| Number | Yes (initial value: **0**) | | updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes.<br>If the value is **0**, this field does not take effect.<br>If the value is a positive integer ***N***, the interval is calculated by multiplying ***N*** and 30 minutes.| Number | Yes (initial value: **0**) |
| formConfigAbility | Name of the facility or activity used to adjust a widget. | String | Yes (initial value: left empty) | | formConfigAbility | Link to a specific page of the application. The value is a URI. | String | Yes (initial value: left empty) |
| formVisibleNotify | Whether the widget is allowed to use the widget visibility notification. | String | Yes (initial value: left empty) | | formVisibleNotify | Whether the widget is allowed to use the widget visibility notification. | String | Yes (initial value: left empty) |
| metaData | Metadata of the widget. This field contains the array of the **customizeData** field. | Object | Yes (initial value: left empty) | | metaData | Metadata of the widget. This field contains the array of the **customizeData** field. | Object | Yes (initial value: left empty) |
...@@ -205,7 +204,8 @@ Configure the **module.json** file for the **Form** ability. ...@@ -205,7 +204,8 @@ Configure the **module.json** file for the **Form** ability.
"defaultDimension": "2*2", "defaultDimension": "2*2",
"updateEnabled": true, "updateEnabled": true,
"scheduledUpdateTime": "10:30", "scheduledUpdateTime": "10:30",
"updateDuration": 1 "updateDuration": 1,
"formConfigAbility": "ability://ohos.samples.FormApplication.MainAbility"
}] }]
} }
``` ```
...@@ -338,3 +338,11 @@ You can use HML, CSS, and JSON to develop the UI page for a JavaScript-programme ...@@ -338,3 +338,11 @@ You can use HML, CSS, and JSON to develop the UI page for a JavaScript-programme
Now you've got a widget shown below. Now you've got a widget shown below.
![fa-form-example](figures/fa-form-example.png) ![fa-form-example](figures/fa-form-example.png)
## Development Example
The following sample is provided to help you better understand how to develop a widget on the stage model:
[eTSFormExtAbility](https://gitee.com/openharmony/app_samples/tree/master/ability/eTSFormExtAbility)
This **eTSFormExtAbility** sample provides a widget. Users can create, update, and delete widgets on the home screen of their phones or by using their own widget host. This sample also implements widget information persistence by using lightweight data storage.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册