js-apis-formbindingdata.md 1.5 KB
Newer Older
W
wusongqing 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
# FormBindingData

> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.

## Modules to Import

```
import formBindingData from '@ohos.application.formBindingData';
```

## Required Permissions

None

## formBindingData.createFormBindingData

createFormBindingData(obj?: Object | string): FormBindingData

Creates a **FormBindingData** object.

- Parameters

  | Name| Type| Mandatory| Description|
  | ------ | -------------- | ---- | ------------------------------------------------------------ |
  | obj    | Object or string| No| Data to be displayed on the JS service widget. The value can be an object containing multiple key-value pairs or a string in JSON format.|



- Return value

  | Type| Description|
  | ----------------------------------- | --------------------------------------- |
  | [FormBindingData](#formbindingdata) | **FormBindingData** object created based on the passed data.|



- Example

  ```
  let obj = {"temperature": "21°"};
  let formBindingDataObj = formBindingData.createFormBindingData(obj);
  ```

## FormBindingData

Describes a **FormBindingData** object.

| Name| Type| Description|
| ---- | -------------- | ------------------------------------------------------------ |
| obj  | Object or string| Data to be displayed on the JS service widget. The value can be an object containing multiple key-value pairs or a string in JSON format.|