harmony 鸿蒙Hyperlink
Hyperlink
The <Hyperlink> component implements a link from a location in the component to another location.
NOTE
- This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
- This component must be used with the system browser.
Required Permissions
If Internet access is required, you need to apply for the ohos.permission.INTERNET permission. For details about how to apply for a permission, see Declaring Permissions.
Child Components
Supported
APIs
Hyperlink(address: string|Resource, content?: string|Resource)
Since API version 9, this API is supported in ArkTS widgets.
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
address | string |Resource | Yes | Web page to which the hyperlink is redirected. |
content | string |Resource | No | Text displayed in the hyperlink. NOTE If this component has child components, the hyperlink text is not displayed. |
Attributes
Only the following attributes are supported.
Name | Type | Description |
---|---|---|
color | ResourceColor | Color of the hyperlink text. |
Example
@Entry
@Component
struct HyperlinkExample {
build() {
Column() {
Column() {
Hyperlink('https://example.com/') {
Image($r('app.media.bg'))
.width(200)
.height(100)
}
}
Column() {
Hyperlink('https://example.com/', 'Go to the developer website') {
}
.color(Color.Blue)
}
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙ArkTS-based Declarative Development Paradigm
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦