From d4af213e3a0f9939693733ca12e010a2d064a4f3 Mon Sep 17 00:00:00 2001 From: yu-shihao4 Date: Tue, 6 Sep 2022 14:54:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90web=E3=80=91web=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81url=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yu-shihao4 --- .../arkui-ts/ts-basic-components-web.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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 818d42f1b4..bcb0d3480f 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)。 -- GitLab