Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c44c48f8
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c44c48f8
编写于
8月 29, 2023
作者:
Y
yxn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
处理接口一致性问题
Signed-off-by:
N
yxn
<
yexinnian2@huawei.com
>
上级
d77f5c8d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
41 deletion
+10
-41
zh-cn/application-dev/reference/apis/js-apis-file-picker.md
zh-cn/application-dev/reference/apis/js-apis-file-picker.md
+10
-41
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-file-picker.md
浏览文件 @
c44c48f8
...
@@ -8,8 +8,13 @@
...
@@ -8,8 +8,13 @@
## 导入模块
## 导入模块
> **说明:**
>
> 示例代码里有使用BusinessError的都需要导入BusinessError模块,没有的话则不需要导入。
```
ts
```
ts
import
picker
from
'
@ohos.file.picker
'
;
import
picker
from
'
@ohos.file.picker
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
```
```
## PhotoViewPicker
## PhotoViewPicker
...
@@ -47,8 +52,6 @@ select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult>
...
@@ -47,8 +52,6 @@ select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example01
()
{
async
example01
()
{
try
{
try
{
let
PhotoSelectOptions
=
new
picker
.
PhotoSelectOptions
();
let
PhotoSelectOptions
=
new
picker
.
PhotoSelectOptions
();
...
@@ -84,8 +87,6 @@ select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult&
...
@@ -84,8 +87,6 @@ select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult&
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example02
()
{
async
example02
()
{
try
{
try
{
let
PhotoSelectOptions
=
new
picker
.
PhotoSelectOptions
();
let
PhotoSelectOptions
=
new
picker
.
PhotoSelectOptions
();
...
@@ -122,8 +123,6 @@ select(callback: AsyncCallback<PhotoSelectResult>) : void
...
@@ -122,8 +123,6 @@ select(callback: AsyncCallback<PhotoSelectResult>) : void
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example03
()
{
async
example03
()
{
try
{
try
{
let
photoPicker
=
new
picker
.
PhotoViewPicker
();
let
photoPicker
=
new
picker
.
PhotoViewPicker
();
...
@@ -163,8 +162,6 @@ save(option?: PhotoSaveOptions) : Promise<Array<string>>
...
@@ -163,8 +162,6 @@ save(option?: PhotoSaveOptions) : Promise<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example04
()
{
async
example04
()
{
try
{
try
{
let
PhotoSaveOptions
=
new
picker
.
PhotoSaveOptions
();
let
PhotoSaveOptions
=
new
picker
.
PhotoSaveOptions
();
...
@@ -199,8 +196,6 @@ save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>
...
@@ -199,8 +196,6 @@ save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example05
()
{
async
example05
()
{
try
{
try
{
let
PhotoSaveOptions
=
new
picker
.
PhotoSaveOptions
();
let
PhotoSaveOptions
=
new
picker
.
PhotoSaveOptions
();
...
@@ -236,8 +231,6 @@ save(callback: AsyncCallback<Array<string>>) : void
...
@@ -236,8 +231,6 @@ save(callback: AsyncCallback<Array<string>>) : void
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example06
()
{
async
example06
()
{
try
{
try
{
let
photoPicker
=
new
picker
.
PhotoViewPicker
();
let
photoPicker
=
new
picker
.
PhotoViewPicker
();
...
@@ -289,8 +282,6 @@ select(option?: DocumentSelectOptions) : Promise<Array<string>>
...
@@ -289,8 +282,6 @@ select(option?: DocumentSelectOptions) : Promise<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example07
()
{
async
example07
()
{
try
{
try
{
let
DocumentSelectOptions
=
new
picker
.
DocumentSelectOptions
();
let
DocumentSelectOptions
=
new
picker
.
DocumentSelectOptions
();
...
@@ -324,8 +315,6 @@ select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string
...
@@ -324,8 +315,6 @@ select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example08
()
{
async
example08
()
{
try
{
try
{
let
DocumentSelectOptions
=
new
picker
.
DocumentSelectOptions
();
let
DocumentSelectOptions
=
new
picker
.
DocumentSelectOptions
();
...
@@ -360,8 +349,6 @@ select(callback: AsyncCallback<Array<string>>) : void
...
@@ -360,8 +349,6 @@ select(callback: AsyncCallback<Array<string>>) : void
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example09
()
{
async
example09
()
{
try
{
try
{
let
documentPicker
=
new
picker
.
DocumentViewPicker
();
let
documentPicker
=
new
picker
.
DocumentViewPicker
();
...
@@ -402,8 +389,6 @@ save(option?: DocumentSaveOptions) : Promise<Array<string>>
...
@@ -402,8 +389,6 @@ save(option?: DocumentSaveOptions) : Promise<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example10
()
{
async
example10
()
{
try
{
try
{
let
DocumentSaveOptions
=
new
picker
.
DocumentSaveOptions
();
let
DocumentSaveOptions
=
new
picker
.
DocumentSaveOptions
();
...
@@ -438,8 +423,6 @@ save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>
...
@@ -438,8 +423,6 @@ save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example11
()
{
async
example11
()
{
try
{
try
{
let
DocumentSaveOptions
=
new
picker
.
DocumentSaveOptions
();
let
DocumentSaveOptions
=
new
picker
.
DocumentSaveOptions
();
...
@@ -475,8 +458,6 @@ save(callback: AsyncCallback<Array<string>>) : void
...
@@ -475,8 +458,6 @@ save(callback: AsyncCallback<Array<string>>) : void
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example12
()
{
async
example12
()
{
try
{
try
{
let
documentPicker
=
new
picker
.
DocumentViewPicker
();
let
documentPicker
=
new
picker
.
DocumentViewPicker
();
...
@@ -528,8 +509,6 @@ select(option?: AudioSelectOptions) : Promise<Array<string>>
...
@@ -528,8 +509,6 @@ select(option?: AudioSelectOptions) : Promise<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example13
()
{
async
example13
()
{
try
{
try
{
let
AudioSelectOptions
=
new
picker
.
AudioSelectOptions
();
let
AudioSelectOptions
=
new
picker
.
AudioSelectOptions
();
...
@@ -563,8 +542,6 @@ select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>
...
@@ -563,8 +542,6 @@ select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example14
()
{
async
example14
()
{
try
{
try
{
let
AudioSelectOptions
=
new
picker
.
AudioSelectOptions
();
let
AudioSelectOptions
=
new
picker
.
AudioSelectOptions
();
...
@@ -599,8 +576,6 @@ select(callback: AsyncCallback<Array<string>>) : void
...
@@ -599,8 +576,6 @@ select(callback: AsyncCallback<Array<string>>) : void
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example15
()
{
async
example15
()
{
try
{
try
{
let
audioPicker
=
new
picker
.
AudioViewPicker
();
let
audioPicker
=
new
picker
.
AudioViewPicker
();
...
@@ -640,8 +615,6 @@ save(option?: AudioSaveOptions) : Promise<Array<string>>
...
@@ -640,8 +615,6 @@ save(option?: AudioSaveOptions) : Promise<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example16
()
{
async
example16
()
{
try
{
try
{
let
AudioSaveOptions
=
new
picker
.
AudioSaveOptions
();
let
AudioSaveOptions
=
new
picker
.
AudioSaveOptions
();
...
@@ -676,8 +649,6 @@ save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>
...
@@ -676,8 +649,6 @@ save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example17
()
{
async
example17
()
{
try
{
try
{
let
AudioSaveOptions
=
new
picker
.
AudioSaveOptions
();
let
AudioSaveOptions
=
new
picker
.
AudioSaveOptions
();
...
@@ -713,8 +684,6 @@ save(callback: AsyncCallback<Array<string>>) : void
...
@@ -713,8 +684,6 @@ save(callback: AsyncCallback<Array<string>>) : void
**示例:**
**示例:**
```
ts
```
ts
import
{
BusinessError
}
from
'
@ohos.base
'
;
async
example18
()
{
async
example18
()
{
try
{
try
{
let
audioPicker
=
new
picker
.
AudioViewPicker
();
let
audioPicker
=
new
picker
.
AudioViewPicker
();
...
@@ -783,9 +752,9 @@ async example18() {
...
@@ -783,9 +752,9 @@ async example18() {
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| ----------------------- | ------------------- | ---- | -------------------------------- |
| ----------------------- | ------------------- | ---- | -------------------------------- |
| maxSelectNumber | number | 否 | 选择文件/目录最大个数,上限500,有效值范围1-500 |
| maxSelectNumber
<sup>
10+
</sup>
| number | 否 | 选择文件/目录最大个数,上限500,有效值范围1-500 |
| defaultFilePathUri | string | 否 | 指定选择的文件或者目录路径 |
| defaultFilePathUri
<sup>
10+
</sup>
| string | 否 | 指定选择的文件或者目录路径 |
| fileSuffixFilters | Array
<
string
>
| 否 | 选择文件的后缀类型 |
| fileSuffixFilters
<sup>
10+
</sup>
| Array
<
string
>
| 否 | 选择文件的后缀类型 |
## DocumentSaveOptions
## DocumentSaveOptions
...
@@ -796,8 +765,8 @@ async example18() {
...
@@ -796,8 +765,8 @@ async example18() {
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| ----------------------- | ------------------- | ---- | ---------------------------- |
| ----------------------- | ------------------- | ---- | ---------------------------- |
| newFileNames | Array
<
string
>
| 否 | 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入 |
| newFileNames | Array
<
string
>
| 否 | 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入 |
| defaultFilePathUri | string | 否 | 指定保存的文件或者目录路径 |
| defaultFilePathUri
<sup>
10+
</sup>
| string | 否 | 指定保存的文件或者目录路径 |
| fileSuffixChoices | Array
<
string
>
| 否 | 保存文件的后缀类型 |
| fileSuffixChoices
<sup>
10+
</sup>
| Array
<
string
>
| 否 | 保存文件的后缀类型 |
## AudioSelectOptions
## AudioSelectOptions
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录