From 9ace50b622f61e40ad44d1b70038a081d48516a3 Mon Sep 17 00:00:00 2001 From: DCloud-yyl Date: Mon, 14 Aug 2023 21:46:07 +0800 Subject: [PATCH] Update data-type.md --- docs/uts/data-type.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/uts/data-type.md b/docs/uts/data-type.md index c74a7638b..3f8260c3e 100644 --- a/docs/uts/data-type.md +++ b/docs/uts/data-type.md @@ -697,6 +697,14 @@ console.log(listData["count"]); //42 console.log(listArr[0]["title"]); //第一组 ``` +多层级下标访问是需要使用 as 转换为UTSJSONObject +```ts +var j = {"test":{ + "a-b": 1 +}} +console.log((j['test'] as UTSJSONObject)['a-b']); +``` + 3. 通过keyPath访问 类型属性 在`HBuilderX` 3.9.0 之后的版本,UTSJSONObject提供了另外一种属性访问方式 -- GitLab