Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
cefd7e53
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看板
提交
cefd7e53
编写于
8月 25, 2023
作者:
Z
zhangjing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify web docs for Interface onShowFileSelector
Signed-off-by:
N
zhangjing
<
zhangjing403@huawei.com
>
上级
8afc691a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
18 deletion
+26
-18
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
...ication-dev/reference/arkui-ts/ts-basic-components-web.md
+26
-18
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
浏览文件 @
cefd7e53
...
@@ -2193,7 +2193,8 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
...
@@ -2193,7 +2193,8 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
```
ts
```
ts
// xxx.ets
// xxx.ets
import
web_webview
from
'
@ohos.web.webview
'
import
web_webview
from
'
@ohos.web.webview
'
;
import
picker
from
'
@ohos.file.picker
'
;
@
Entry
@
Entry
@
Component
@
Component
...
@@ -2202,24 +2203,18 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
...
@@ -2202,24 +2203,18 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
build
()
{
build
()
{
Column
()
{
Column
()
{
Web
({
src
:
'
www.example.com
'
,
controller
:
this
.
controller
})
Web
({
src
:
$rawfile
(
'
index.html
'
)
,
controller
:
this
.
controller
})
.
onShowFileSelector
((
event
)
=>
{
.
onShowFileSelector
((
event
)
=>
{
AlertDialog
.
show
({
console
.
log
(
'
MyFileUploader onShowFileSelector invoked
'
)
title
:
event
.
fileSelector
.
getTitle
(),
const
documentSelectOptions
=
new
picker
.
DocumentSelectOptions
();
message
:
'
isCapture:
'
+
event
.
fileSelector
.
isCapture
()
+
"
mode:
"
+
event
.
fileSelector
.
getMode
()
+
'
acceptType:
'
+
event
.
fileSelector
.
getAcceptType
(),
let
uri
=
null
;
confirm
:
{
const
documentViewPicker
=
new
picker
.
DocumentViewPicker
();
value
:
'
upload
'
,
documentViewPicker
.
select
(
documentSelectOptions
).
then
((
documentSelectResult
)
=>
{
action
:
()
=>
{
uri
=
documentSelectResult
[
0
];
let
fileList
:
Array
<
string
>
=
[
console
.
info
(
'
documentViewPicker.select to file succeed and uri is:
'
+
uri
);
'
/data/storage/el2/base/test
'
,
event
.
result
.
handleFileList
([
uri
]);
]
}).
catch
((
err
)
=>
{
event
.
result
.
handleFileList
(
fileList
)
console
.
error
(
`Invoke documentViewPicker.select failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
}
},
cancel
:
()
=>
{
let
fileList
:
Array
<
string
>
=
[]
event
.
result
.
handleFileList
(
fileList
)
}
})
})
return
true
return
true
})
})
...
@@ -2227,6 +2222,19 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
...
@@ -2227,6 +2222,19 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
}
}
}
}
```
```
加载的html文件。
```
html
<!DOCTYPE html>
<html>
<head>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
charset=
"utf-8"
>
</head>
<body>
<form
id=
"upload-form"
enctype=
"multipart/form-data"
>
<input
type=
"file"
id=
"upload"
name=
"upload"
/>
</body>
```
### onResourceLoad<sup>9+</sup>
### onResourceLoad<sup>9+</sup>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录