Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
0d20c8b5
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
0d20c8b5
编写于
8月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!7865 NWebp find api implement doc
Merge pull request !7865 from fredranking/master
上级
ebe29125
f262d3e6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
138 addition
and
1 deletion
+138
-1
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
...ication-dev/reference/arkui-ts/ts-basic-components-web.md
+138
-1
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md
浏览文件 @
0d20c8b5
...
...
@@ -3093,6 +3093,143 @@ static getOriginUsage(origin : string) : Promise\<number>
}
}
```
### searchAllAsync<sup>9+</sup>
searchAllAsync(searchString: string): void
异步查找网页中所有匹配关键字'searchString'的内容并高亮,结果通过
[
onSearchResultReceive
](
#onsearchresultreceive9
)
异步返回。
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---- | ------ | ---- | ---- | --------------------- |
| searchString | string | 是 | - | 查找的关键字。 |
**示例:**
```
ts
// xxx.ets
@
Entry
@
Component
struct
WebComponent
{
controller
:
WebController
=
new
WebController
();
@
State
searchString
:
string
=
"
xxx
"
;
build
()
{
Column
()
{
Button
(
'
searchString
'
)
.
onClick
(()
=>
{
this
.
controller
.
searchAllAsync
(
this
.
searchString
);
})
Button
(
'
clearMatches
'
)
.
onClick
(()
=>
{
this
.
controller
.
clearMatches
();
})
Button
(
'
searchNext
'
)
.
onClick
(()
=>
{
this
.
controller
.
searchNext
(
true
);
})
Web
({
src
:
'
www.example.com
'
,
controller
:
this
.
controller
})
.
onSearchResultReceive
(
ret
=>
{
console
.
log
(
"
on search result receive:
"
+
"
[cur]
"
+
ret
.
activeMatchOrdinal
+
"
[total]
"
+
ret
.
numberOfMatches
+
"
[isDone]
"
+
ret
.
isDoneCounting
);
})
}
}
}
```
### clearMatches<sup>9+</sup>
clearMatches(): void
清除所有通过
[
searchAllAsync
](
#searchallasync9
)
匹配到的高亮字符查找结果。
**示例:**
```
ts
// xxx.ets
@
Entry
@
Component
struct
WebComponent
{
controller
:
WebController
=
new
WebController
();
build
()
{
Column
()
{
Button
(
'
clearMatches
'
)
.
onClick
(()
=>
{
this
.
controller
.
clearMatches
();
})
Web
({
src
:
'
www.example.com
'
,
controller
:
this
.
controller
})
}
}
}
```
### searchNext<sup>9+</sup>
searchNext(forward: boolean): void
滚动到下一个匹配的查找结果并高亮。
**参数:**
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---- | ------ | ---- | ---- | --------------------- |
| forward | boolean | 是 | - | 从前向后或者逆向查找。 |
**示例:**
```
ts
// xxx.ets
@
Entry
@
Component
struct
WebComponent
{
controller
:
WebController
=
new
WebController
();
build
()
{
Column
()
{
Button
(
'
searchNext
'
)
.
onClick
(()
=>
{
this
.
controller
.
searchNext
(
true
);
})
Web
({
src
:
'
www.example.com
'
,
controller
:
this
.
controller
})
}
}
}
```
### onSearchResultReceive<sup>9+</sup>
onSearchResultReceive(callback: (event?: {activeMatchOrdinal: number, numberOfMatches: number, isDoneCounting: boolean}) => void): WebAttribute
回调通知调用方网页页内查找的结果。
**参数:**
| 参数名 | 参数类型 | 参数描述 |
| ------------------ | ------------- | ----------------------------------- |
| activeMatchOrdinal | number | 当前匹配的查找项的序号(从0开始)。 |
| numberOfMatches | number | 所有匹配到的关键词的个数。 |
| isDoneCounting | boolean | 当次页内查找操作是否结束。该方法可能会回调多次,直到isDoneCounting为true为止。 |
**示例:**
```
ts
// xxx.ets
@
Entry
@
Component
struct
WebComponent
{
controller
:
WebController
=
new
WebController
();
build
()
{
Column
()
{
Web
({
src
:
'
www.example.com
'
,
controller
:
this
.
controller
})
.
onSearchResultReceive
(
ret
=>
{
console
.
log
(
"
on search result receive:
"
+
"
[cur]
"
+
ret
.
activeMatchOrdinal
+
"
[total]
"
+
ret
.
numberOfMatches
+
"
[isDone]
"
+
ret
.
isDoneCounting
);
})
}
}
}
```
## WebStorageOrigin<sup>9+</sup>
...
...
@@ -3167,4 +3304,4 @@ onRenderExited接口返回的渲染进程退出的具体原因。
| 名称 | 描述 | 备注 |
| --------- | -------------- | -------------- |
| MidiSysex | MIDI SYSEX资源。| 目前仅支持权限事件上报,MIDI设备的使用还未支持。|
\ No newline at end of file
| MidiSysex | MIDI SYSEX资源。| 目前仅支持权限事件上报,MIDI设备的使用还未支持。|
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录