Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f60e5fec
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看板
未验证
提交
f60e5fec
编写于
1月 11, 2023
作者:
J
jwx1068251
提交者:
Gitee
1月 11, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改超链接,添加ScopeComparable内compareTo方法说明
Signed-off-by:
N
jwx1068251
<
jiangkai43@huawei.com
>
上级
69d9f6a3
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
35 addition
and
20 deletion
+35
-20
zh-cn/application-dev/reference/apis/js-apis-util.md
zh-cn/application-dev/reference/apis/js-apis-util.md
+35
-20
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-util.md
浏览文件 @
f60e5fec
...
@@ -338,7 +338,7 @@ TextDecoder的构造函数。
...
@@ -338,7 +338,7 @@ TextDecoder的构造函数。
### create<sup>9+</sup>
### create<sup>9+</sup>
create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean }
,
): TextDecoder;
create(encoding?: string,options?: { fatal?: boolean; ignoreBOM?: boolean }): TextDecoder;
替代有参构造功能。
替代有参构造功能。
...
@@ -410,13 +410,13 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
...
@@ -410,13 +410,13 @@ decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string
### constructor<sup>(deprecated)</sup>
### constructor<sup>(deprecated)</sup>
constructor(encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }
,
)
constructor(encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean })
TextDecoder的构造函数。
TextDecoder的构造函数。
> **说明:**
> **说明:**
>
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[c
onstructor<sup>9+</sup>](#constructor
9)替代。
> 从API version 7开始支持,从API version 9开始废弃,建议使用[c
reate<sup>9+</sup>](#create
9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -440,7 +440,7 @@ TextDecoder的构造函数。
...
@@ -440,7 +440,7 @@ TextDecoder的构造函数。
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
let
textDecoder
=
new
util
.
TextDecoder
(
"
utf-8
"
,{
ignoreBOM
:
true
});
```
```
### decode
### decode
<sup>(deprecated)</sup>
decode(input: Uint8Array, options?: { stream?: false }): string
decode(input: Uint8Array, options?: { stream?: false }): string
...
@@ -448,7 +448,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string
...
@@ -448,7 +448,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string
> **说明:**
> **说明:**
>
>
> 从API version 7开始支持,从API version 9开始废弃,建议使用[decodeWithStream<sup>9+</sup>](#decode
WithS
tream9)替代。
> 从API version 7开始支持,从API version 9开始废弃,建议使用[decodeWithStream<sup>9+</sup>](#decode
withs
tream9)替代。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
...
@@ -1590,28 +1590,32 @@ let result = pro[Symbol.iterator]();
...
@@ -1590,28 +1590,32 @@ let result = pro[Symbol.iterator]();
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
```
js
interface
ScopeComparable
{
compareTo
(
other
:
ScopeComparable
):
boolean
;
}
```
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
##
ScopeType
<sup>8+</sup>
##
# compareTo
<sup>8+</sup>
用于表示范围中的值的类型。
compareTo(other: ScopeComparable): boolean;
比较两个值的大小,返回一个布尔值。
**系统能力:**
SystemCapability.Utils.Lang
**系统能力:**
SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---- | ---- | -------------- |
| other |
[
ScopeComparable
](
#scopecomparable8
)
| 是 | 表示要比较的值。 |
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| -------- | -------- |
| ---- | ------------------ |
| number | 表示值的类型为数字。 |
| boolean | 调用compareTo的值大于等于传入的值返回true,否则返回false。|
|
[
ScopeComparable
](
#ScopeComparable8
)
| 表示值的类型为ScopeComparable。|
**示例:**
构造新类,实现compareTo方法。后续示例代码中,均
通过Temperature,获取
[
ScopeType
](
#scopetype8
)
的实例化对象
。
构造新类,实现compareTo方法。后续示例代码中,均
以此Temperature类为例
。
示例:
```
js
```
js
class
Temperature
{
class
Temperature
{
constructor
(
value
){
constructor
(
value
){
...
@@ -1631,6 +1635,17 @@ class Temperature{
...
@@ -1631,6 +1635,17 @@ class Temperature{
}
}
```
```
## ScopeType<sup>8+</sup>
用于表示范围中的值的类型。
**系统能力:**
SystemCapability.Utils.Lang
| 类型 | 说明 |
| -------- | -------- |
| number | 表示值的类型为数字。 |
|
[
ScopeComparable
](
#scopecomparable8
)
| 表示值的类型为ScopeComparable。|
## ScopeHelper<sup>9+</sup>
## ScopeHelper<sup>9+</sup>
### constructor<sup>9+</sup>
### constructor<sup>9+</sup>
...
@@ -1710,7 +1725,7 @@ let range = new util.ScopeHelper(tempLower, tempUpper);
...
@@ -1710,7 +1725,7 @@ let range = new util.ScopeHelper(tempLower, tempUpper);
let
tempMiDF
=
new
Temperature
(
35
);
let
tempMiDF
=
new
Temperature
(
35
);
let
tempMidS
=
new
Temperature
(
39
);
let
tempMidS
=
new
Temperature
(
39
);
let
rangeFir
=
new
util
.
ScopeHelper
(
tempMiDF
,
tempMidS
);
let
rangeFir
=
new
util
.
ScopeHelper
(
tempMiDF
,
tempMidS
);
range
.
intersect
(
rangeFir
);
range
.
intersect
(
rangeFir
);
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录