diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index 818d42f1b493564be1f383859d8246a6d5741f59..bcb0d3480f4f94ee5712ce4ce86f0f025dde6f6c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -3102,6 +3102,38 @@ postMessage(options: { message: WebMessageEvent, uri: string}): void }) ``` +### getUrl9+ + +getUrl(): string + +获取当前页面的url地址。 + +**返回值:** + +| 类型 | 说明 | +| ------------------------------- | ------------- | +| string | 当前页面的url地址。 | + +**示例:** + + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + build() { + Column() { + Button('getUrl') + .onClick(() => { + console.log("url: " + this.controller.getUrl()); + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ## HitTestValue9+ 提供点击区域的元素信息。示例代码参考[getHitTestValue](#gethittestvalue9)。