From 8e9dbba8f5eacf9125efa36b186ffd676d75143c Mon Sep 17 00:00:00 2001 From: CodingGorit Date: Thu, 15 May 2025 16:16:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20FAQ=20PackageStructureKit=20?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoginModule/BuildProfile.ets | 17 ++++++++ PackageStructureKit/LoginModule/Index.ets | 2 + .../LoginModule/build-profile.json5 | 31 ++++++++++++++ .../LoginModule/consumer-rules.txt | 0 PackageStructureKit/LoginModule/hvigorfile.ts | 6 +++ .../LoginModule/obfuscation-rules.txt | 23 ++++++++++ .../LoginModule/oh-package.json5 | 9 ++++ .../src/main/ets/components/LoginPage.ets | 42 +++++++++++++++++++ .../src/main/ets/components/MainPage.ets | 19 +++++++++ .../LoginModule/src/main/module.json5 | 11 +++++ .../main/resources/base/element/float.json | 8 ++++ .../main/resources/base/element/string.json | 8 ++++ .../src/ohosTest/ets/test/Ability.test.ets | 35 ++++++++++++++++ .../src/ohosTest/ets/test/List.test.ets | 5 +++ .../LoginModule/src/ohosTest/module.json5 | 13 ++++++ .../LoginModule/src/test/List.test.ets | 5 +++ .../LoginModule/src/test/LocalUnit.test.ets | 33 +++++++++++++++ PackageStructureKit/build-profile.json5 | 4 ++ .../entry/oh-package-lock.json5 | 18 ++++++++ PackageStructureKit/entry/oh-package.json5 | 27 +++++++++++- .../main/ets/pages/CrossModulePageJump.ets | 36 +--------------- .../ets/pages/ErrorInObtainingHSPFile.ets | 6 +-- 22 files changed, 320 insertions(+), 38 deletions(-) create mode 100644 PackageStructureKit/LoginModule/BuildProfile.ets create mode 100644 PackageStructureKit/LoginModule/Index.ets create mode 100644 PackageStructureKit/LoginModule/build-profile.json5 create mode 100644 PackageStructureKit/LoginModule/consumer-rules.txt create mode 100644 PackageStructureKit/LoginModule/hvigorfile.ts create mode 100644 PackageStructureKit/LoginModule/obfuscation-rules.txt create mode 100644 PackageStructureKit/LoginModule/oh-package.json5 create mode 100644 PackageStructureKit/LoginModule/src/main/ets/components/LoginPage.ets create mode 100644 PackageStructureKit/LoginModule/src/main/ets/components/MainPage.ets create mode 100644 PackageStructureKit/LoginModule/src/main/module.json5 create mode 100644 PackageStructureKit/LoginModule/src/main/resources/base/element/float.json create mode 100644 PackageStructureKit/LoginModule/src/main/resources/base/element/string.json create mode 100644 PackageStructureKit/LoginModule/src/ohosTest/ets/test/Ability.test.ets create mode 100644 PackageStructureKit/LoginModule/src/ohosTest/ets/test/List.test.ets create mode 100644 PackageStructureKit/LoginModule/src/ohosTest/module.json5 create mode 100644 PackageStructureKit/LoginModule/src/test/List.test.ets create mode 100644 PackageStructureKit/LoginModule/src/test/LocalUnit.test.ets create mode 100644 PackageStructureKit/entry/oh-package-lock.json5 diff --git a/PackageStructureKit/LoginModule/BuildProfile.ets b/PackageStructureKit/LoginModule/BuildProfile.ets new file mode 100644 index 00000000..3a501e5d --- /dev/null +++ b/PackageStructureKit/LoginModule/BuildProfile.ets @@ -0,0 +1,17 @@ +/** + * Use these variables when you tailor your ArkTS code. They must be of the const type. + */ +export const HAR_VERSION = '1.0.0'; +export const BUILD_MODE_NAME = 'debug'; +export const DEBUG = true; +export const TARGET_NAME = 'default'; + +/** + * BuildProfile Class is used only for compatibility purposes. + */ +export default class BuildProfile { + static readonly HAR_VERSION = HAR_VERSION; + static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; + static readonly DEBUG = DEBUG; + static readonly TARGET_NAME = TARGET_NAME; +} \ No newline at end of file diff --git a/PackageStructureKit/LoginModule/Index.ets b/PackageStructureKit/LoginModule/Index.ets new file mode 100644 index 00000000..d3ddc9be --- /dev/null +++ b/PackageStructureKit/LoginModule/Index.ets @@ -0,0 +1,2 @@ +export { MainPage } from './src/main/ets/components/MainPage'; +export { LoginPage } from './src/main/ets/components/LoginPage'; diff --git a/PackageStructureKit/LoginModule/build-profile.json5 b/PackageStructureKit/LoginModule/build-profile.json5 new file mode 100644 index 00000000..e6773f9f --- /dev/null +++ b/PackageStructureKit/LoginModule/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + }, + "consumerFiles": [ + "./consumer-rules.txt" + ] + } + }, + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest" + } + ] +} diff --git a/PackageStructureKit/LoginModule/consumer-rules.txt b/PackageStructureKit/LoginModule/consumer-rules.txt new file mode 100644 index 00000000..e69de29b diff --git a/PackageStructureKit/LoginModule/hvigorfile.ts b/PackageStructureKit/LoginModule/hvigorfile.ts new file mode 100644 index 00000000..42187071 --- /dev/null +++ b/PackageStructureKit/LoginModule/hvigorfile.ts @@ -0,0 +1,6 @@ +import { harTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/PackageStructureKit/LoginModule/obfuscation-rules.txt b/PackageStructureKit/LoginModule/obfuscation-rules.txt new file mode 100644 index 00000000..272efb6c --- /dev/null +++ b/PackageStructureKit/LoginModule/obfuscation-rules.txt @@ -0,0 +1,23 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/PackageStructureKit/LoginModule/oh-package.json5 b/PackageStructureKit/LoginModule/oh-package.json5 new file mode 100644 index 00000000..f5cc20f8 --- /dev/null +++ b/PackageStructureKit/LoginModule/oh-package.json5 @@ -0,0 +1,9 @@ +{ + "name": "@ohos/login", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "Index.ets", + "author": "", + "license": "Apache-2.0", + "dependencies": {} +} diff --git a/PackageStructureKit/LoginModule/src/main/ets/components/LoginPage.ets b/PackageStructureKit/LoginModule/src/main/ets/components/LoginPage.ets new file mode 100644 index 00000000..27a05f5f --- /dev/null +++ b/PackageStructureKit/LoginModule/src/main/ets/components/LoginPage.ets @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* FAQ:如何实现跨模块的页面跳转功能 +*/ + +// [Start login_page_with_module] +@Component +export struct LoginPage { + @Consume('pathStack') pathStack: NavPathStack; + @State message: string = 'Login Page'; + + build() { + NavDestination() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } + .onBackPressed(() => { + this.pathStack.pop(); + return true; + }) + } +} +// [End login_page_with_module] \ No newline at end of file diff --git a/PackageStructureKit/LoginModule/src/main/ets/components/MainPage.ets b/PackageStructureKit/LoginModule/src/main/ets/components/MainPage.ets new file mode 100644 index 00000000..9de5eb33 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/main/ets/components/MainPage.ets @@ -0,0 +1,19 @@ +@Component +export struct MainPage { + @State message: string = 'Hello World'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize($r('app.float.page_text_font_size')) + .fontWeight(FontWeight.Bold) + .onClick(() => { + this.message = 'Welcome'; + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/PackageStructureKit/LoginModule/src/main/module.json5 b/PackageStructureKit/LoginModule/src/main/module.json5 new file mode 100644 index 00000000..bfbf3f70 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/main/module.json5 @@ -0,0 +1,11 @@ +{ + "module": { + "name": "LoginModule", + "type": "har", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ] + } +} diff --git a/PackageStructureKit/LoginModule/src/main/resources/base/element/float.json b/PackageStructureKit/LoginModule/src/main/resources/base/element/float.json new file mode 100644 index 00000000..33ea2230 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/PackageStructureKit/LoginModule/src/main/resources/base/element/string.json b/PackageStructureKit/LoginModule/src/main/resources/base/element/string.json new file mode 100644 index 00000000..f51a9c84 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from package" + } + ] +} diff --git a/PackageStructureKit/LoginModule/src/ohosTest/ets/test/Ability.test.ets b/PackageStructureKit/LoginModule/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 00000000..85c78f67 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,35 @@ +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }) + }) +} \ No newline at end of file diff --git a/PackageStructureKit/LoginModule/src/ohosTest/ets/test/List.test.ets b/PackageStructureKit/LoginModule/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 00000000..794c7dc4 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,5 @@ +import abilityTest from './Ability.test'; + +export default function testsuite() { + abilityTest(); +} \ No newline at end of file diff --git a/PackageStructureKit/LoginModule/src/ohosTest/module.json5 b/PackageStructureKit/LoginModule/src/ohosTest/module.json5 new file mode 100644 index 00000000..f1fd6a70 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/ohosTest/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "LoginModule_test", + "type": "feature", + "deviceTypes": [ + "default", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/PackageStructureKit/LoginModule/src/test/List.test.ets b/PackageStructureKit/LoginModule/src/test/List.test.ets new file mode 100644 index 00000000..bb5b5c37 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/test/List.test.ets @@ -0,0 +1,5 @@ +import localUnitTest from './LocalUnit.test'; + +export default function testsuite() { + localUnitTest(); +} \ No newline at end of file diff --git a/PackageStructureKit/LoginModule/src/test/LocalUnit.test.ets b/PackageStructureKit/LoginModule/src/test/LocalUnit.test.ets new file mode 100644 index 00000000..165fc161 --- /dev/null +++ b/PackageStructureKit/LoginModule/src/test/LocalUnit.test.ets @@ -0,0 +1,33 @@ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function localUnitTest() { + describe('localUnitTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }); +} \ No newline at end of file diff --git a/PackageStructureKit/build-profile.json5 b/PackageStructureKit/build-profile.json5 index 03ac3a3a..2e47cfdc 100644 --- a/PackageStructureKit/build-profile.json5 +++ b/PackageStructureKit/build-profile.json5 @@ -36,6 +36,10 @@ ] } ] + }, + { + "name": "LoginModule", + "srcPath": "./LoginModule", } ] } \ No newline at end of file diff --git a/PackageStructureKit/entry/oh-package-lock.json5 b/PackageStructureKit/entry/oh-package-lock.json5 new file mode 100644 index 00000000..65a9e371 --- /dev/null +++ b/PackageStructureKit/entry/oh-package-lock.json5 @@ -0,0 +1,18 @@ +{ + "meta": { + "stableOrder": true + }, + "lockfileVersion": 3, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "@ohos/login@../LoginModule": "@ohos/login@../LoginModule" + }, + "packages": { + "@ohos/login@../LoginModule": { + "name": "@ohos/login", + "version": "1.0.0", + "resolved": "../LoginModule", + "registryType": "local" + } + } +} \ No newline at end of file diff --git a/PackageStructureKit/entry/oh-package.json5 b/PackageStructureKit/entry/oh-package.json5 index 248c3b75..70f3a622 100644 --- a/PackageStructureKit/entry/oh-package.json5 +++ b/PackageStructureKit/entry/oh-package.json5 @@ -1,10 +1,35 @@ +/* +* Copyright (c) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* FAQ:如何实现跨模块的页面跳转功能 +*/ + +// [Start login_with_module_dependency] { + // [StartExclude login_with_module_dependency] "name": "entry", "version": "1.0.0", "description": "Please describe the basic information.", "main": "", "author": "", "license": "", - "dependencies": {} + // [EndExclude login_with_module_dependency] + "dependencies": { + "@ohos/login": "file:../LoginModule" + } } +// [End login_with_module_dependency] diff --git a/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets b/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets index 81fa65b6..9eb5ff7a 100644 --- a/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets +++ b/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets @@ -17,40 +17,8 @@ * FAQ:如何实现跨模块的页面跳转功能 */ -// DocsCode 1 -@Component -export struct LoginPage { - @Consume('pathStack') pathStack: NavPathStack; - @State message: string = 'Login Page'; - - build() { - NavDestination() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } - .onBackPressed(() => { - this.pathStack.pop(); - return true; - }) - } -} -// DocsCode 1 - -// DocsCode 2 -{ - // ... - "dependencies": { - "@ohos/login": "file:../login" - } -} -// DocsCode 2 -// DocsCode 3 +// [Start navigation_page] // 导入Login模块自定义组件 import { LoginPage } from '@ohos/login'; @@ -78,4 +46,4 @@ struct NavigationPage { .navDestination(this.pageMap) } } -// DocsCode 3 \ No newline at end of file +// [End navigation_page] \ No newline at end of file diff --git a/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets b/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets index 214bf8ca..9c32523f 100644 --- a/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets +++ b/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets @@ -17,7 +17,7 @@ * FAQ:通过resourceManager.getStringResource接口获取HSP资源文件报“Resource id invalid”错误 */ -// DocsCode 1 +// [Start error_in_obtaining_hsp_file] import { common, application } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { JSON } from '@kit.ArkTS'; @@ -25,7 +25,7 @@ import { JSON } from '@kit.ArkTS'; @Entry @Component struct Index { - private context = UIContext.getHostContext() as common.UIAbilityContext; + private context = this.getUIContext().getHostContext() as common.UIAbilityContext; build() { Column() { @@ -59,4 +59,4 @@ struct Index { } } } -// DocsCode 1 \ No newline at end of file +// [End error_in_obtaining_hsp_file] \ No newline at end of file -- Gitee From 90ac4069a031dbe0a5b5e964c746910f82e95bf3 Mon Sep 17 00:00:00 2001 From: Gorit Date: Fri, 16 May 2025 09:50:28 +0000 Subject: [PATCH 2/3] update PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets. Signed-off-by: Gorit --- .../entry/src/main/ets/pages/CrossModulePageJump.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets b/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets index 9eb5ff7a..35cdea2f 100644 --- a/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets +++ b/PackageStructureKit/entry/src/main/ets/pages/CrossModulePageJump.ets @@ -19,7 +19,7 @@ // [Start navigation_page] -// 导入Login模块自定义组件 +// Import a custom component of the Login module import { LoginPage } from '@ohos/login'; @Entry @@ -38,7 +38,7 @@ struct NavigationPage { Navigation(this.pathStack) { Button('jump to login page') .onClick(() => { - // NavPathInfo第二个参数为自定义参数,可用于信息传递 + // The second parameter of NavPathInfo is a custom parameter that can be used for message transfer let pathInfo: NavPathInfo = new NavPathInfo('loginPage', new Object()); this.pathStack.pushDestination(pathInfo, true); }) -- Gitee From a68073dc87c787bc79a93f494650dfc93b5bbb58 Mon Sep 17 00:00:00 2001 From: Gorit Date: Fri, 16 May 2025 09:51:37 +0000 Subject: [PATCH 3/3] update PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets. Signed-off-by: Gorit --- .../entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets b/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets index 9c32523f..b10654d0 100644 --- a/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets +++ b/PackageStructureKit/entry/src/main/ets/pages/ErrorInObtainingHSPFile.ets @@ -31,18 +31,18 @@ struct Index { Column() { Button() .onClick(() => { - // 根据模块名创建上下文Context + // Create a context based on the module name let moduleName: string = 'library'; application.createModuleContext(this.context, moduleName) .then((data: common.Context) => { console.info(`CreateModuleContext success, data: ${JSON.stringify(data)}`); if (data !== null) { this.getUIContext().getPromptAction().showToast({ - message: ('成功获取Context') + message: ('get Context success') }); } - // 然后通过getStringByNameSync获取指定资源名称对应的字符串 + // Then run getStringByNameSync to obtain the string corresponding to the specified resource name try { let str = data.resourceManager.getStringByNameSync('shared_desc'); console.info(`getStringByNameSync, data: ${JSON.stringify(str)}`); -- Gitee