Skip to content

Hyperlink

重要

跳转需要申请权限

跳转的目标应用使用网络时,需要申请权限 ohos.permission.INTERNET

子组件

可以包含Image组件

参数

  • address

Hyperlink 组件跳转的网页。

  • content

Hyperlink 组件中超链接显示文本。

属性

color

设置超链接文本的颜色

示例

js
@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)
  }
}