From fccd289571eb21ee63794499756379d55a1e7e39 Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 21 Nov 2024 18:04:53 +0800 Subject: [PATCH] chore: canvasContext measureText --- docs/api/canvas/CanvasContext.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/canvas/CanvasContext.md b/docs/api/canvas/CanvasContext.md index db16aba0a..951a88309 100644 --- a/docs/api/canvas/CanvasContext.md +++ b/docs/api/canvas/CanvasContext.md @@ -658,6 +658,9 @@ ctx.draw() ![uniapp](https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/line-to.png) ## CanvasContext.measureText + +> 该方法在 HarmonyOS Next 设备上是异步,需要传入回调函数获取文本尺寸信息。 + 测量文本尺寸信息,目前仅返回文本宽度。同步接口。(App 端 2.8.12+ 支持) **参数** @@ -665,6 +668,7 @@ ctx.draw() |参数 |类型 |说明 | |--- |--- |--- | |text |String |要测量的文本 | +|callback |({metricsWidth: number} => void) |测量回调 `仅 HarmonyOS Next 支持` | **返回** -- GitLab