“ba9afa2959954b244767a135f6fbd0a5bf854abb”上不存在“...reference/apis/js-apis-system-date-time.md”
提交 81237f34 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 d800f6cd
# Public File Access and Management # User File Access and Management
>![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:** >![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> >
>- 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. >- 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.
>- The APIs of this module are system APIs and cannot be called by third-party applications. Currently, these APIs can be called only by **filepicker**. >- The APIs of this module are system APIs and cannot be called by third-party applications. Currently, these APIs can be called only by **filepicker**.
...@@ -14,20 +14,20 @@ import filemanager from '@ohos.fileManager'; ...@@ -14,20 +14,20 @@ import filemanager from '@ohos.fileManager';
getRoot(options? : {dev? : DevInfo}) : Promise&lt;FileInfo[]&gt; getRoot(options? : {dev? : DevInfo}) : Promise&lt;FileInfo[]&gt;
Obtains information about the files in the first-level directory in asynchronous mode. This method uses a promise to return the result. Obtains information about the root album or directory in asynchronous mode. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.FileManagerService **System capability**: SystemCapability.FileManagement.FileManagerService
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| --- | --- | --- | -- | | --- | --- | --- | -- |
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: Device type. For details, see [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
- Return value - Return value
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise&lt;[FileInfo](#fileinfo)[]&gt; | Promise used to return the file information obtained.| | Promise&lt;[FileInfo](#fileinfo)[]&gt; | Promise used to return the root album or directory information obtained.|
- Example - Example
...@@ -35,7 +35,7 @@ Obtains information about the files in the first-level directory in asynchronous ...@@ -35,7 +35,7 @@ Obtains information about the files in the first-level directory in asynchronous
filemanager.getRoot().then((fileInfo) => { filemanager.getRoot().then((fileInfo) => {
if(Array.isArray(fileInfo)) { if(Array.isArray(fileInfo)) {
for (var i = 0; i < fileInfo.length; i++) { for (var i = 0; i < fileInfo.length; i++) {
console.log(JSON.Stringify(fileInfo)) console.log("file:"+JSON.stringify(fileInfo));
} }
} }
}).catch((err) => { }).catch((err) => {
...@@ -47,7 +47,7 @@ Obtains information about the files in the first-level directory in asynchronous ...@@ -47,7 +47,7 @@ Obtains information about the files in the first-level directory in asynchronous
getRoot(options? : {dev? : DevInfo}, callback : AsyncCallback&lt;FileInfo[]&gt;) : void getRoot(options? : {dev? : DevInfo}, callback : AsyncCallback&lt;FileInfo[]&gt;) : void
Obtains information about the files in the first-level directory in asynchronous mode. This method uses a callback to return the result. Obtains information about the root album or directory in asynchronous mode. This API uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.FileManagerService **System capability**: SystemCapability.FileManagement.FileManagerService
...@@ -55,8 +55,8 @@ Obtains information about the files in the first-level directory in asynchronous ...@@ -55,8 +55,8 @@ Obtains information about the files in the first-level directory in asynchronous
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------- | | -------- | ------------------------- | ---- | ----------------------------- |
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: Device type. For details, see [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
| callback | AsyncCallback&lt;[FileInfo](#fileinfo)[]&gt; | Yes | Callback invoked to return the file information obtained. | | callback | AsyncCallback&lt;[FileInfo](#fileinfo)[]&gt; | Yes | Callback invoked to return the root album or directory information obtained. |
- Example - Example
...@@ -64,7 +64,7 @@ Obtains information about the files in the first-level directory in asynchronous ...@@ -64,7 +64,7 @@ Obtains information about the files in the first-level directory in asynchronous
filemanager.getRoot((err, fileInfo) => { filemanager.getRoot((err, fileInfo) => {
if(Array.isArray(fileInfo)) { if(Array.isArray(fileInfo)) {
for (var i = 0; i < fileInfo.length; i++) { for (var i = 0; i < fileInfo.length; i++) {
console.log(JSON.Stringify(fileInfo)) console.log("file:"+JSON.stringify(fileInfo));
} }
} }
}); });
...@@ -74,7 +74,7 @@ Obtains information about the files in the first-level directory in asynchronous ...@@ -74,7 +74,7 @@ Obtains information about the files in the first-level directory in asynchronous
listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : number, count? : number}) : Promise&lt;FileInfo[]&gt; listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : number, count? : number}) : Promise&lt;FileInfo[]&gt;
Obtains information about the files in the second-level directory in asynchronous mode. This method uses a promise to return the result. Obtains information about the second-level album or files in asynchronous mode. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.FileManagerService **System capability**: SystemCapability.FileManagement.FileManagerService
...@@ -83,32 +83,32 @@ Obtains information about the files in the second-level directory in asynchronou ...@@ -83,32 +83,32 @@ Obtains information about the files in the second-level directory in asynchronou
| --- | --- | --- | -- | | --- | --- | --- | -- |
| path | string | Yes| URI of the directory to query.| | path | string | Yes| URI of the directory to query.|
| type | string | Yes| Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| | type | string | Yes| Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.|
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: Device type. For details, see [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- &nbsp;**offset**: position to start the query. The value is a number.<br>- &nbsp;**count**: number of files to query.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- &nbsp;**offset**: position to start the query. The value is a number.<br>- &nbsp;**count**: number of files to query.|
- Return value - Return value
| Type| Description| | Type| Description|
| --- | -- | | --- | -- |
| Promise&lt;FileInfo[]&gt; | Promise used to return the file information obtained.| | Promise&lt;FileInfo[]&gt; | Promise used to return the album or file information obtained.|
- Error - Error
| Error Info| Error Code|Description| | Error Info| Error Code|Description|
| -- | --- | -- | | -- | --- | -- |
| No such file or directory | 2 | The directory or file of the specified URI does not exist.| | No such file or directory | 2 | The directory or album of the specified URI does not exist.|
| No such process | 3 | Failed to obtain the FMS service.| | No such process | 3 | Failed to obtain the FMS service.|
| Not a directory | 20 | The object specified by the URI is not a directory.| | Not a directory | 20 | The object specified by the URI is not a directory or album.|
- Example - Example
```js ```js
// Obtain all files in the directory. // Obtain all files in the directory.
// Call listFile() and getRoot() to obtain file URIs. // Call listFile() and getRoot() to obtain the file URI.
let media_path = file.uri let media_path = file.uri
filemanager.listFile(media_path, "file") filemanager.listFile(media_path, "file")
.then((fileInfo) => { .then((fileInfo) => {
if(Array.isArray(fileInfo)) { if(Array.isArray(fileInfo)) {
for (var i = 0; i < fileInfo.length; i++) { for (var i = 0; i < fileInfo.length; i++) {
console.log(JSON.Stringify(fileInfo)) console.log("file:"+JSON.stringify(fileInfo));
} }
} }
}).catch((err) => { }).catch((err) => {
...@@ -120,7 +120,7 @@ Obtains information about the files in the second-level directory in asynchronou ...@@ -120,7 +120,7 @@ Obtains information about the files in the second-level directory in asynchronou
listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : number, count? : number}, callback : AsyncCallback&lt;FileInfo[]&gt;) : void listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : number, count? : number}, callback : AsyncCallback&lt;FileInfo[]&gt;) : void
Obtains information about the files in the second-level directory in asynchronous mode. This method uses a callback to return the result. Obtains information about the second-level album or files in asynchronous mode. This API uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.FileManagerService **System capability**: SystemCapability.FileManagement.FileManagerService
...@@ -130,25 +130,25 @@ Obtains information about the files in the second-level directory in asynchronou ...@@ -130,25 +130,25 @@ Obtains information about the files in the second-level directory in asynchronou
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| path | string | Yes | URI of the directory to query. | | path | string | Yes | URI of the directory to query. |
| type | string | Yes | Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| | type | string | Yes | Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.|
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: Device type. For details, see [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- &nbsp;**offset**: position to start the query. The value is a number.<br>- &nbsp;**count**: number of files to query.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.<br>- &nbsp;**offset**: position to start the query. The value is a number.<br>- &nbsp;**count**: number of files to query.|
| callback | AsyncCallback&lt;[FileInfo](#fileinfo)[]&gt; | Yes | Callback invoked to return the file information obtained. | | callback | AsyncCallback&lt;[FileInfo](#fileinfo)[]&gt; | Yes | Callback invoked to return the file information obtained. |
- Error - Error
| Error Info | Error Code| Description | | Error Info | Error Code| Description |
| ------------------------- | ------ | ------------------------- | | ------------------------- | ------ | ------------------------- |
| No such file or directory | 2 | The directory or file of the specified URI does not exist.| | No such file or directory | 2 | The directory or album of the specified URI does not exist.|
| No such process | 3 | Failed to obtain the FMS service. | | No such process | 3 | Failed to obtain the FMS service. |
| Not a directory | 20 | The object specified by the URI is not a directory.| | Not a directory | 20 | The object specified by the URI is not a directory or album.|
- Example - Example
```js ```js
// Call listFile() and getRoot() to obtain file URIs. // Call listFile() and getRoot() to obtain the file URI.
let media_path = file.uri let media_path = file.uri
filemanager.listFile(media_path, "file", (err, fileInfo) => { filemanager.listFile(media_path, "file", (err, fileInfo) => {
if(Array.isArray(fileInfo)) { if(Array.isArray(fileInfo)) {
for (var i = 0; i < fileInfo.length; i++) { for (var i = 0; i < fileInfo.length; i++) {
console.log(JSON.Stringify(fileInfo)) console.log("file:"+JSON.stringify(fileInfo));
} }
} }
}); });
...@@ -158,7 +158,7 @@ Obtains information about the files in the second-level directory in asynchronou ...@@ -158,7 +158,7 @@ Obtains information about the files in the second-level directory in asynchronou
filemanager.createFile(path : string, filename : string, options? : {dev? : DevInfo}) : Promise&lt;string&gt; filemanager.createFile(path : string, filename : string, options? : {dev? : DevInfo}) : Promise&lt;string&gt;
Creates a file in the specified path in asynchronous mode. This method uses a promise to return the result. Creates a file in the specified path in asynchronous mode. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.FileManagerService **System capability**: SystemCapability.FileManagement.FileManagerService
...@@ -167,7 +167,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr ...@@ -167,7 +167,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr
| --- | --- | --- | -- | | --- | --- | --- | -- |
| filename | string | Yes| Name of the file to create.| | filename | string | Yes| Name of the file to create.|
| path | string | Yes| URI of the file to create.| | path | string | Yes| URI of the file to create.|
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: Device type. For details, see [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
- Return value - Return value
...@@ -179,9 +179,9 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr ...@@ -179,9 +179,9 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr
| Error Info| Error Code|Description| | Error Info| Error Code|Description|
| -- | --- | -- | | -- | --- | -- |
| Operation not permitted | 1 | A file with the same name already exists.| | Operation not permitted | 1 | A file with the same name already exists.|
| No such file or directory | 2 | The directory or file of the specified URI does not exist.| | No such file or directory | 2 | The directory or album of the specified URI does not exist.|
| No such process | 3 | Failed to obtain the FMS service.| | No such process | 3 | Failed to obtain the FMS service.|
| Not a directory | 20 | The object specified by the URI is not a directory.| | Not a directory | 20 | The object specified by the URI is not a directory or album.|
- Example - Example
...@@ -189,12 +189,11 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr ...@@ -189,12 +189,11 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr
// Create a file. // Create a file.
let media_path = file.uri // Obtain the file URI using listFile() and getRoot(). let media_path = file.uri // Obtain the file URI using listFile() and getRoot().
let name = "xxx.jpg" // File to be saved. let name = "xxx.jpg" // File to be saved.
filemanager.createFile(media_path, name) filemanager.createFile(media_path, name).then((uri) => {
.then((uri) => { // The URI of the file created is returned.
// The URI of the file created is returned. console.log("file uri:"+uri);
}) }).catch((err) => {
.catch((err) => { console.log(err);
console.log(err)
}); });
``` ```
...@@ -202,7 +201,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr ...@@ -202,7 +201,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr
createFile(path : string, filename: string, options? : {dev? : DevInfo}, callback : AsyncCallback&lt;string&gt;) : void createFile(path : string, filename: string, options? : {dev? : DevInfo}, callback : AsyncCallback&lt;string&gt;) : void
Creates a file in the specified path in asynchronous mode. This method uses a callback to return the result. Creates a file in the specified path in asynchronous mode. This API uses a callback to return the result.
**System capability**: SystemCapability.FileManagement.FileManagerService **System capability**: SystemCapability.FileManagement.FileManagerService
...@@ -212,7 +211,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca ...@@ -212,7 +211,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca
| -------- | ------------------------- | ---- | ----------------------------- | | -------- | ------------------------- | ---- | ----------------------------- |
| filename | string | Yes | Name of the file to create. | | filename | string | Yes | Name of the file to create. |
| path | string | Yes | URI of the file to create. | | path | string | Yes | URI of the file to create. |
| options | Object | No| The options are as follows:<br>- &nbsp;**dev**: Device type. For details, see [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | options | Object | No| The options are as follows:<br>- &nbsp;**dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.|
| callback | AsyncCallback&lt;[FileInfo](#fileinfo)[]&gt; | Yes | Callback invoked to return the file information obtained. | | callback | AsyncCallback&lt;[FileInfo](#fileinfo)[]&gt; | Yes | Callback invoked to return the file information obtained. |
- Error - Error
...@@ -220,9 +219,9 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca ...@@ -220,9 +219,9 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca
| Error Info | Error Code| Description | | Error Info | Error Code| Description |
| ------------------------- | ------ | ------------------------- | | ------------------------- | ------ | ------------------------- |
| Operation not permitted | 1 | A file with the same name already exists. | | Operation not permitted | 1 | A file with the same name already exists. |
| No such file or directory | 2 | The directory or file of the specified URI does not exist.| | No such file or directory | 2 | The directory or album of the specified URI does not exist.|
| No such process | 3 | Failed to obtain the FMS service. | | No such process | 3 | Failed to obtain the FMS service. |
| Not a directory | 20 | The object specified by the URI is not a directory.| | Not a directory | 20 | The object specified by the URI is not a directory or album.|
- Example - Example
...@@ -233,7 +232,8 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca ...@@ -233,7 +232,8 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca
// File to be saved. // File to be saved.
let name = "xxx.jpg" let name = "xxx.jpg"
filemanager.createFile(media_path, name, (err, uri) => { filemanager.createFile(media_path, name, (err, uri) => {
// The URI of the file created is returned. // The URI of the file created is returned.
console.log("file uri:"+uri);
}); });
``` ```
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> >
> - The APIs of this module are no longer maintained since API Version 6. You are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). > - The APIs of this module are no longer maintained since API Version 6, and you are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API Version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md).
> >
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
## Modules to Import ## Modules to Import
``` ```js
import storage from '@system.storage'; import storage from '@system.storage';
``` ```
...@@ -19,7 +19,7 @@ import storage from '@system.storage'; ...@@ -19,7 +19,7 @@ import storage from '@system.storage';
get(Object): void get(Object): void
Obtains the stored data. Reads the value stored in the cache based on the specified key.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core **System capability**: SystemCapability.DistributedDataManager.Preferences.Core
...@@ -27,15 +27,15 @@ Obtains the stored data. ...@@ -27,15 +27,15 @@ Obtains the stored data.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Index of the data to obtain.| | key | string | Yes| Key of the data to read.|
| default | string | No| Default value returned when the **key** does not exist.| | default | string | No| Default value returned when the **key** does not exist.|
| success | Function | No| Called when the stored data is successfully obtained.| | success | Function | No| Called to return the value obtained when **storage.get()** is successful.|
| fail | Function | No| Called when the stored data failed to be obtained.| | fail | Function | No| Called when **storage.get()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.|
| complete | Function | No| Called when the execution is complete.| | complete | Function | No| Called when **storage.get()** is complete.|
**Example** **Example**
``` ```js
export default { export default {
storageGet() { storageGet() {
storage.get({ storage.get({
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
set(Object): void set(Object): void
Modifies the stored data. Sets the value in the cache based on the specified key.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core **System capability**: SystemCapability.DistributedDataManager.Preferences.Core
...@@ -67,15 +67,15 @@ Modifies the stored data. ...@@ -67,15 +67,15 @@ Modifies the stored data.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Index of the data to modify.| | key | string | Yes| Key of the value to set.|
| value | string | No| New value to set. The maximum length is 128 bytes.| | value | string | Yes| New value to set. The maximum length is 128 bytes.|
| success | Function | No| Called when the data is successfully modified.| | success | Function | No| Called when **storage.set()** is successful.|
| fail | Function | No| Called when the data failed to be modified.| | fail | Function | No| Called when **storage.set()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.|
| complete | Function | No| Called when the execution is complete.| | complete | Function | No| Called when **storage.set()** is complete.|
**Example** **Example**
``` ```js
export default { export default {
storageSet() { storageSet() {
storage.set({ storage.set({
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
clear(Object): void clear(Object): void
Clears the stored data. Clears the key-value pairs from the cache.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core **System capability**: SystemCapability.DistributedDataManager.Preferences.Core
...@@ -105,13 +105,13 @@ Clears the stored data. ...@@ -105,13 +105,13 @@ Clears the stored data.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| success | Function | No| Called when the data is successfully cleared.| | success | Function | No| Called when **storage.clear()** is successful.|
| fail | Function | No| Called when the data failed to be cleared.| | fail | Function | No| Called when **storage.clear()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.|
| complete | Function | No| Called when the execution is complete.| | complete | Function | No| Called when **storage.clear()** is complete.|
**Example** **Example**
``` ```js
export default { export default {
storageClear() { storageClear() {
storage.clear({ storage.clear({
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
delete(Object): void delete(Object): void
Deletes the stored data. Deletes the key-value pair based on the specified key.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core **System capability**: SystemCapability.DistributedDataManager.Preferences.Core
...@@ -139,14 +139,14 @@ Deletes the stored data. ...@@ -139,14 +139,14 @@ Deletes the stored data.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| key | string | Yes| Index of the data to delete.| | key | string | Yes| Key of the data to delete.|
| success | Function | No| Called when the data is deleted.| | success | Function | No| Called when **storage.delete()** is successful.|
| fail | Function | No| Called when the data failed to be deleted.| | fail | Function | No| Called when **storage.delete()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.|
| complete | Function | No| Called when the execution is complete.| | complete | Function | No| Called when **storage.delete()** is complete.|
**Example** **Example**
``` ```js
export default { export default {
storageDelete() { storageDelete() {
storage.delete({ storage.delete({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册