1# Hyperlink 2<!--Kit: ArkUI--> 3<!--Subsystem: ArkUI--> 4<!--Owner: @hddgzw--> 5<!--Designer: @pssea--> 6<!--Tester: @jiaoaozihao--> 7<!--Adviser: @HelloCrease--> 8 9超链接组件,组件宽高范围内点击实现跳转。 10 11> **说明:** 12> 13> - 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 14> - 该组件仅支持与系统浏览器配合使用。 15 16## 需要权限 17 18跳转的目标应用使用网络时,需要申请权限ohos.permission.INTERNET。具体申请方式请参考[声明权限](../../../security/AccessToken/declare-permissions.md)。 19 20## 子组件 21 22可以包含[Image](ts-basic-components-image.md)子组件。 23 24## 接口 25 26Hyperlink(address: string | Resource, content?: string | Resource) 27 28**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 29 30**系统能力:** SystemCapability.ArkUI.ArkUI.Full 31 32**参数:** 33 34| 参数名 | 类型 | 必填 | 说明 | 35| -------- | -------- | -------- | -------- | 36| address | string \| [Resource](ts-types.md#resource) | 是 | Hyperlink组件跳转的网页。 | 37| content | string \| [Resource](ts-types.md#resource) | 否 | Hyperlink组件中超链接显示文本。<br/>**说明:** <br/>组件内有子组件时,不显示超链接文本。 | 38 39## 属性 40 41除支持[通用属性](ts-component-general-attributes.md)外,还支持以下属性: 42 43### color 44 45color(value: Color | number | string | Resource) 46 47设置超链接文本的颜色。 48 49**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 50 51**系统能力:** SystemCapability.ArkUI.ArkUI.Full 52 53**参数:** 54 55| 参数名 | 类型 | 必填 | 说明 | 56| ------ | ------------------------------------------------------------ | ---- | ------------------ | 57| value | [Color](ts-appendix-enums.md#color) \| number \| string \| [Resource](ts-types.md#resource) | 是 | 超链接文本的颜色。<br /><!--RP1-->默认值:'#ff007dff'<br />warable设备上默认值为:'ff1f71ff'<!--RP1End--> 58 59## 示例 60 61该示例展示了超链接图片和文本跳转的效果。 62 63```ts 64@Entry 65@Component 66struct HyperlinkExample { 67 build() { 68 Column() { 69 Column() { 70 Hyperlink('https://example.com/') { 71 // $r('app.media.bg')需要替换为开发者所需的图像资源文件。 72 Image($r('app.media.bg')) 73 .width(200) 74 .height(100) 75 } 76 } 77 78 Column() { 79 Hyperlink('https://example.com/', 'Go to the developer website') { 80 } 81 .color(Color.Blue) 82 } 83 }.width('100%').height('100%').justifyContent(FlexAlign.Center) 84 } 85} 86``` 87 88 89