Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7c255c9e
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看板
未验证
提交
7c255c9e
编写于
8月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23083 modify web docs for Interface onShowFileSelector
Merge pull request !23083 from 章靖/monthly_20230815
上级
f3dc9f8d
cefd7e53
变更
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
浏览文件 @
7c255c9e
...
...
@@ -2197,7 +2197,8 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
```
ts
// xxx.ets
import
web_webview
from
'
@ohos.web.webview
'
import
web_webview
from
'
@ohos.web.webview
'
;
import
picker
from
'
@ohos.file.picker
'
;
@
Entry
@
Component
...
...
@@ -2206,24 +2207,18 @@ onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector
build
()
{
Column
()
{
Web
({
src
:
'
www.example.com
'
,
controller
:
this
.
controller
})
Web
({
src
:
$rawfile
(
'
index.html
'
)
,
controller
:
this
.
controller
})
.
onShowFileSelector
((
event
)
=>
{
AlertDialog
.
show
({
title
:
event
.
fileSelector
.
getTitle
(),
message
:
'
isCapture:
'
+
event
.
fileSelector
.
isCapture
()
+
"
mode:
"
+
event
.
fileSelector
.
getMode
()
+
'
acceptType:
'
+
event
.
fileSelector
.
getAcceptType
(),
confirm
:
{
value
:
'
upload
'
,
action
:
()
=>
{
let
fileList
:
Array
<
string
>
=
[
'
/data/storage/el2/base/test
'
,
]
event
.
result
.
handleFileList
(
fileList
)
}
},
cancel
:
()
=>
{
let
fileList
:
Array
<
string
>
=
[]
event
.
result
.
handleFileList
(
fileList
)
}
console
.
log
(
'
MyFileUploader onShowFileSelector invoked
'
)
const
documentSelectOptions
=
new
picker
.
DocumentSelectOptions
();
let
uri
=
null
;
const
documentViewPicker
=
new
picker
.
DocumentViewPicker
();
documentViewPicker
.
select
(
documentSelectOptions
).
then
((
documentSelectResult
)
=>
{
uri
=
documentSelectResult
[
0
];
console
.
info
(
'
documentViewPicker.select to file succeed and uri is:
'
+
uri
);
event
.
result
.
handleFileList
([
uri
]);
}).
catch
((
err
)
=>
{
console
.
error
(
`Invoke documentViewPicker.select failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
return
true
})
...
...
@@ -2231,6 +2226,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>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录