提交 7f821a59 编写于 作者: D donglin

Merge branch 'master' of gitee.com:donglin9/docs into specification

Change-Id: I584427ebf6db45fe914fa0e3623bec025a1b5c88
......@@ -28,26 +28,29 @@ Obtain a **Preferences** instance for data operations. A **Preferences** instanc
| --------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ohos.data.preferences | getPreferences(context: Context, name: string): Promise\<Preferences> | Obtains a **Preferences** instance.|
### Accessing Data
### Processing Data
Call the **put()** method to add or modify data in a **Preferences** instance.
Call **put()** to add or modify data in a **Preferences** instance.
Call the **get()** method to read data from a **Preferences** instance.
Call **get()** to read data from a **Preferences** instance.
Call **getAll()** to obtain an **Object** instance that contains all KV pairs in a **Preferences** instance.
**Table 2** APIs for accessing **Preferences** data
Call **delete()** to delete the KV pair of the specified key from the **Preferences** instance.
**Table 2** APIs for processing **Preferences** data
| Class | API | Description |
| ----------- | ---------------------------------------------------------- | ------------------------------------------------------------ |
| Preferences | put(key: string, value: ValueType): Promise\<void> | Writes data to the **Preferences** instance. The value to write can be a number, a string, a Boolean value, or an array of numbers, strings, or Boolean values.|
| Preferences | get(key: string, defValue: ValueType): Promise\<ValueType> | Obtains data from the **Preferences** instance. The value to read can be a number, a string, a Boolean value, or an array of numbers, strings, or Boolean values.|
| Preferences | getAll(): Promise<Object> | Obtains an **Object** instance that contains all KV pairs in the **Preferences** instance. |
| Preferences | getAll(): Promise\<Object> | Obtains an **Object** instance that contains all KV pairs in the **Preferences** instance. |
| Preferences | delete(key: string): Promise\<void> | Deletes the KV pair of the specified key from the **Preferences** instance. |
### Storing Data Persistently
Call the **flush()** method to write the cached data back to its text file for persistent storage.
Call **flush()** to write the cached data back to its text file for persistent storage.
**Table 4** API for data persistence
......@@ -68,7 +71,7 @@ You can subscribe to data changes. When the value of the subscribed key is chang
### Deleting Data
Use the following APIs to delete a **Preferences** instance or data file.
You can use the following APIs to delete a **Preferences** instance or data file.
**Table 6** APIs for deleting **Preferences**
......@@ -130,7 +133,7 @@ Use the following APIs to delete a **Preferences** instance or data file.
3. Write data.
Use the **preferences.put()** method to write data to the **Preferences** instance.
Use **preferences.put()** to write data to the **Preferences** instance.
```js
let putPromise = preferences.put('startup', 'auto');
......@@ -143,7 +146,7 @@ Use the following APIs to delete a **Preferences** instance or data file.
4. Read data.
Use the **preferences.get()** method to read data.
Use **preferences.get()** to read data.
```js
let getPromise = preferences.get('startup', 'default');
......@@ -156,7 +159,7 @@ Use the following APIs to delete a **Preferences** instance or data file.
5. Store data persistently.
Use the **flush()** method to flush data from the **Preferences** instance to its file.
Use **flush()** to flush data from the **Preferences** instance to its file.
```js
preferences.flush();
......@@ -190,7 +193,7 @@ Use the following APIs to delete a **Preferences** instance or data file.
7. Delete the specified file.
Use the **deletePreferences** method to delete the **Preferences** instance and its persistent file and backup and corrupted files. After the specified files are deleted, the application cannot use that instance to perform any data operation. Otherwise, data inconsistency will be caused. The deleted data and files cannot be restored.
Use **deletePreferences()** to delete the **Preferences** instance and its persistent file and backup and corrupted files. After the specified files are deleted, the application cannot use that instance to perform any data operation. Otherwise, data inconsistency will be caused. The deleted data and files cannot be restored.
```js
let proDelete = data_preferences.deletePreferences(context, 'mystore');
......
......@@ -7,7 +7,7 @@ For details about the system parameter design principles and definitions, see
> **NOTE**
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are system APIs.
> - Third-party applications cannot use the APIs provided by this module, because system parameters each require specific discretionary access control (DAC) and MAC permissions.
> - Third-party applications cannot use the APIs provided by this module, because system parameters each require specific discretionary access control (DAC) and mandatory access control (MAC) permissions.
## Modules to Import
......
......@@ -16,31 +16,31 @@ Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: n
**Parameters**
| Name | Value Type | Mandatory | Description |
| ---------- | ---------------- | --------- | ---------------------------------------- |
| refreshing | boolean | Yes | Whether the current component is being refreshed.<br>This parameter can be used with $$ for two-way binding of variables. |
| offset | string \| number | No | Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.<br>Default value: **16**, in vp |
| friction | number \| string | No | Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.<br>Default value: **62**<br>- **0** indicates that the **\<Refresh>** component is not sensitive to the pull-down gesture.<br>- **100** indicates that the **\<Refresh>** component is highly sensitive to the pull-down gesture.<br>- A larger value indicates a more sensitive response of the **\<Refresh>** component to the pull-down gesture. |
| Name| Value Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| refreshing | boolean | Yes| Whether the current component is being refreshed.<br>This parameter supports [$$](../../quick-start/arkts-restrictions-and-extensions.md#two-way-binding-of-variables) for two-way binding of variables.|
| offset | string \| number | No| Distance to the top of the parent component from the **<Refresh\>** component that comes to rest after a successful pull-down gesture.<br>Default value: **16**, in vp|
| friction | number \| string | No| Coefficient of friction, which indicates the **<Refresh\>** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.<br>Default value: **62**<br>- **0** indicates that the **\<Refresh>** component is not sensitive to the pull-down gesture.<br>- **100** indicates that the **\<Refresh>** component is highly sensitive to the pull-down gesture.<br>- A larger value indicates a more sensitive response of the **\<Refresh>** component to the pull-down gesture.|
## Events
| Name | Description |
| ---------------------------------------- | ---------------------------------------- |
| onStateChange(callback: (state: RefreshStatus) => void) | Triggered when the refresh status changes.<br>- **state**: refresh status. |
| onRefreshing(callback: () => void) | Triggered when the component enters the refresh state. |
| Name| Description|
| -------- | -------- |
| onStateChange(callback: (state: [RefreshStatus](#refreshstatus)) => void)| Triggered when the refresh status changes.<br>- **state**: refresh status.|
| onRefreshing(callback: () => void)| Triggered when the component enters the refresh state.|
## RefreshStatus enums
| Name | Description |
| -------- | ---------------------------------------- |
| Inactive | The component is not pulled down. This is the default value. |
| Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh. |
| OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh. |
| Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state. |
| Done | The refresh is complete, and the component returns to the initial state (top). |
| Name| Description|
| -------- | -------- |
| Inactive | The component is not pulled down. This is the default value.|
| Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh.|
| OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh.|
| Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state.|
| Done | The refresh is complete, and the component returns to the initial state (top).|
## Example
......
......@@ -17,29 +17,14 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () =&gt; void, aut
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------------- | ---------------------------------------- | --------- | ---------------------------------------- |
| builder | CustomDialog | Yes | Constructor of the custom dialog box content. |
| ---------------------- | ---------------------------------------- | ------------------------- | ---------------------- |
| builder | [CustomDialog](../../quick-start/arkts-dynamic-ui-elememt-building.md#customdialog) | Yes | Constructor of the custom dialog box content. |
| cancel | () =&gt; void | No | Callback invoked when the dialog box is closed after the overlay exits. |
| autoCancel | boolean | No | Whether to allow users to click the overlay to exit.<br>Default value: **true** |
| alignment | [DialogAlignment](#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default** |
| offset | {<br>dx: Length \| [Resource](ts-types.md#resource),<br>dy: Length \| [Resource](ts-types.md#resource)<br>} | No | Offset of the dialog box relative to the alignment position. |
| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.<br>Default value: **DialogAlignment.Default** |
| offset | [Offset](ts-types.md#offset) | No | Offset of the dialog box relative to the alignment position.|
| customStyle | boolean | No | Whether to use a custom style for the dialog box.<br>Default value: **false** |
| gridCount<sup>8+</sup> | number | No | Number of grid columns occupied by the dialog box. |
## DialogAlignment
| Name | Description |
| ------------------------ | -------------------------- |
| Top | Vertical top alignment. |
| Center | Vertical center alignment. |
| Bottom | Vertical bottom alignment. |
| Default | Default alignment. |
| TopStart<sup>8+</sup> | Top left alignment. |
| TopEnd<sup>8+</sup> | Top right alignment. |
| CenterStart<sup>8+</sup> | Center left alignment. |
| CenterEnd<sup>8+</sup> | Center right alignment. |
| BottomStart<sup>8+</sup> | Bottom left alignment. |
| BottomEnd<sup>8+</sup> | Bottom right alignment. |
| gridCount<sup>8+</sup> | number | No | Number of [grid columns](../../ui/ui-ts-layout-grid-container-new.md) occupied by the dialog box.<br>The default value is 4, and the maximum value is the maximum number of columns supported by the system. If this parameter is set to an invalid value, the default value is used.|
## CustomDialogController
......@@ -107,17 +92,28 @@ struct CustomDialogUser {
@State textValue: string = ''
@State inputValue: string = 'click me'
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample({ cancel: this.onCancel, confirm: this.onAccept, textValue: $textValue, inputValue: $inputValue }),
builder: CustomDialogExample({
cancel: this.onCancel,
confirm: this.onAccept,
textValue: $textValue,
inputValue: $inputValue
}),
cancel: this.existApp,
autoCancel: true
autoCancel: true,
alignment: DialogAlignment.Default,
offset: { dx: 0, dy: -20 },
gridCount: 4,
customStyle: false
})
onCancel() {
console.info('Callback when the first button is clicked')
}
onAccept() {
console.info('Callback when the second button is clicked')
}
existApp() {
console.info('Click the callback in the blank area')
}
......
......@@ -10,7 +10,7 @@ The visibility attribute controls whether a component is visible.
| Name | Type | Description |
| ---------- | ---------------------------- | ------------------------------------------ |
| visibility | [Visibility](ts-appendix-enums.md#visibility) | Whether the component is visible. Note that even if a component is invisible, it still needs to be re-created when the page is refreshed. Therefore, you are advised to use [conditional rendering](../../quick-start/arkts-rendering-control.md#conditional-rendering) instead under scenarios where consistently high performance is required.<br>Default value: **Visibility.Visible**|
| visibility | [Visibility](ts-appendix-enums.md#visibility) | Whether the component is visible. Note that even if a component is invisible, it still needs to be re-created when the page is refreshed. Therefore, you are advised to use [conditional rendering](../../quick-start/arkts-rendering-control.md#conditional-rendering) instead under scenarios where consistently high performance is required.<br>Default value: **Visibility.Visible** |
## Example
......@@ -31,7 +31,7 @@ struct VisibilityExample {
Text('Hidden').fontSize(9).width('90%').fontColor(0xCCCCCC)
Row().visibility(Visibility.Hidden).width('90%').height(80).backgroundColor(0xAFEEEE)
// The component is visiable, which is the default display mode.
// The component is visible, which is the default display mode.
Text('Visible').fontSize(9).width('90%').fontColor(0xCCCCCC)
Row().visibility(Visibility.Visible).width('90%').height(80).backgroundColor(0xAFEEEE)
}.width('90%').border({ width: 1 })
......
# Upload and Download Error Codes
## 13400001 File Operation Error
**Error Message**
File operation error.
**Description**
This error code is reported when a file operation error occurs in invoking the **uploadFile** or **downloadFile** API.
**Possible Causes**
The file permission is insufficient.
**Solution**
Make sure you have the required permission on the target files.
## 13400002 File Path Error
**Error Message**
Bad file path.
**Description**
This error code is reported when a file path error occurs in invoking the **uploadFile** or **downloadFile** API.
**Possible Causes**
The file path is incorrect.
**Solution**
Verify the file path.
## 13400003 Service Error
**Error Message**
Task manager service error.
**Description**
This error code is reported when a task manager service error occurs in invoking the **downloadFile** API.
**Possible Causes**
The task fails to be created.
**Solution**
Verify the task settings.
# System Parameter Error Codes
## 14700101 Failure to Query the System Parameter
**Error Message**
System parameter can not be found.
**Description**
This error code is reported when the parameter does not exist in the workspace or no key has been set for the parameter.
**Possible Causes**
The parameter is not set or fails to be set.
**Solution**
Set the parameter correctly.
## 14700102 Invalid System Parameter Value
**Error Message**
System parameter value is invalid.
**Description**
This error code is reported when the value of the system parameter is invalid.
**Possible Causes**
The value of the system parameter is empty, is out of range, or contains special characters, for example, "const..param.xxx".
**Solution**
Set the value to a valid string.
## 14700103 Permission Denial for the Operation on the System Permission
**Error Message**
System permission operation permission denied.
**Description**
This error code is reported when the system parameter does not have the discretionary access control (DAC) or mandatory access control (MAC) permission.
**Possible Causes**
The DAC or MAC permission is not configured.
**Solution**
Add the DAC or MAC permission as needed.
## 14700104 Internal System Error, Including Out of Memory and Deadlock
**Error Message**
System internal error including out of memory, deadlock etc.
**Description**
This error code is reported when the attempt to modify the **const** attribute settings, the socket connection, or the memory copy fails.
**Possible Causes**
The socket connection is abnormal, or the node fails to be added or obtained.
**Solution**
1. Analyze the memory usage of the entire process and eliminate memory leak.
2. If you are in a multi-thread scenario, check the error stack for deadlock.
此差异已折叠。
......@@ -4,3 +4,6 @@
- [媒体资源使用指导](medialibrary-resource-guidelines.md)
- [文件路径使用指导](medialibrary-filepath-guidelines.md)
- [相册资源使用指导](medialibrary-album-guidelines.md)
- 文件访问框架
- [用户公共文件访问框架概述](file-access-framework-overview.md)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册