Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f2b97264
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f2b97264
编写于
12月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12716 翻译完成:11939【轻量级 PR】:update zh-cn/application-dev/reference/apis/js-apis-uri.md.
Merge pull request !12716 from wusongqing/TR11939
上级
57dde419
80a7bbd4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
24 addition
and
22 deletion
+24
-22
en/application-dev/reference/apis/js-apis-uri.md
en/application-dev/reference/apis/js-apis-uri.md
+24
-22
未找到文件。
en/application-dev/reference/apis/js-apis-uri.md
浏览文件 @
f2b97264
#
URI String Parsing
#
@ohos.uri (URI String Parsing)
> **NOTE**
>
...
...
@@ -40,18 +40,18 @@ A constructor used to create a URI instance.
**Parameters**
| Name| Type
.| Readable| Writable
| Description|
| -------- | -------- | -------- | -------- |
-------- |
| uri | string | Yes|
Yes|
Input object.|
| Name| Type
| Mandatory
| Description|
| -------- | -------- | -------- | -------- |
| uri | string | Yes| Input object.|
**Example**
```
js
let
mm
=
'
http://username:password@host:8080/directory/file?foo=1&bar=2#fragment
'
;
new
uri
.
URI
(
mm
);
// Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
let
mm
=
'
http
s
://username:password@host:8080/directory/file?foo=1&bar=2#fragment
'
;
new
uri
.
URI
(
mm
);
// Output 'http
s
://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
```
```
js
new
uri
.
URI
(
'
http
://username:password@host:8080
'
);
// Output 'http
://username:password@host:8080';
new
uri
.
URI
(
'
http
s://username:password@host:8080
'
);
// Output 'https
://username:password@host:8080';
```
...
...
@@ -65,22 +65,23 @@ Obtains the query string applicable to this URI.
**Return value**
| Type
.
| Description|
| Type| Description|
| -------- | -------- |
| string | Website address in a serialized string.|
**Example**
```
js
const
result
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
result
=
new
uri
.
URI
(
'
http
s
://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
result
.
toString
()
```
### equals<sup>(deprecated)</sup>
> **NOTE**
>
> This API is deprecated since API version 9. You are advised to use [equalsTo<sup>9+</sup>](#equalsto9) instead.
> This API is
supported since API version 8 and
deprecated since API version 9. You are advised to use [equalsTo<sup>9+</sup>](#equalsto9) instead.
equals(other: URI): boolean
...
...
@@ -90,21 +91,21 @@ Checks whether this URI is the same as another URI object.
**Parameters**
| Name| Type
.
| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| other |
[
URI
](
#uri
)
| Yes| URI object to compare.|
**Return value**
| Type
.
| Description|
| Type| Description|
| -------- | -------- |
| boolean | Returns
**true**
if the two URIs are the same; returns
**false**
otherwise.|
**Example**
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http
s
://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http
s
://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
uriInstance
.
equals
(
uriInstance1
);
```
### equalsTo<sup>9+</sup>
...
...
@@ -117,21 +118,21 @@ Checks whether this URI is the same as another URI object.
**Parameters**
| Name| Type
.
| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| other |
[
URI
](
#uri
)
| Yes| URI object to compare.|
**Return value**
| Type
.
| Description|
| Type| Description|
| -------- | -------- |
| boolean | Returns
**true**
if the two URIs are the same; returns
**false**
otherwise.|
**Example**
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http
s
://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http
s
://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
uriInstance
.
equalsTo
(
uriInstance1
);
```
...
...
@@ -145,14 +146,14 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi
**Return value**
| Type
.
| Description|
| Type| Description|
| -------- | -------- |
| boolean | Returns
**true**
if the URI is an absolute URI; returns
**false**
otherwise.|
**Example**
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080?query=pppppp
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http
s
://username:password@www.qwer.com:8080?query=pppppp
'
);
uriInstance
.
checkIsAbsolute
();
```
...
...
@@ -167,13 +168,14 @@ Normalizes the path of this URI.
**Return value**
| Type
.
| Description|
| Type| Description|
| -------- | -------- |
| URI | URI with the normalized path.|
**Example**
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http
s
://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp
'
);
let
uriInstance1
=
uriInstance
.
normalize
();
uriInstance1
.
path
;
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录