| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 06-May-2025 | - | 35 | 32 | ||
| entry/ | 06-May-2025 | - | 869 | 758 | ||
| hvigor/ | 06-May-2025 | - | 38 | 36 | ||
| screenshots/ | 06-May-2025 | - | ||||
| .gitignore | D | 06-May-2025 | 133 | 12 | 12 | |
| README.md | D | 06-May-2025 | 2.7 KiB | 73 | 53 | |
| build-profile.json5 | D | 06-May-2025 | 1.4 KiB | 58 | 57 | |
| code-linter.json5 | D | 06-May-2025 | 958 | 35 | 34 | |
| hvigorfile.ts | D | 06-May-2025 | 843 | 22 | 5 | |
| oh-package.json5 | D | 06-May-2025 | 834 | 26 | 24 | |
| ohosTest.md | D | 06-May-2025 | 1 KiB | 8 | 6 |
README.md
1# ArkTS使用Node-API进行string相关开发 2 3### 介绍 4 5使用Node-API关于string的六个接口,可以让Node-API模块和ArkTS字符串进行交互,本工程中展示的代码详细描述可查如下链接中业务扩展场景介绍部分。 6 7- [使用Node-API进行string相关开发](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/napi/use-napi-about-string.md) 8 9### 效果预览 10 11| 首页 | 执行结果图 | 12| ------------------------------------------------------------ | ------------------------------------------------------------ | 13| <img src="./screenshots/NodeApiString1.png" style="zoom: 50%;" /> | <img src="./screenshots/NodeApiString2.png" style="zoom: 50%;" /> | 14 15### 使用说明 16 171. 运行Index主界面。 182. 页面呈现上述首页效果,分别点击ListItem组件可以执行对应文本内容的Node-API接口并将文本Result:改为执行成功结果,然后在控制台中打印出对应日志。 193. 运行测试用例NodeApiString.test.ets文件对页面代码进行测试可以全部通过。 20 21### 工程目录 22 23``` 24entry/src/ 25 ├── main 26 │ ├── cpp 27 │ │ ├── types 28 │ │ ├── Index.d.ts 29 │ │ ├── oh-package.json5 30 │ │ ├── CMakeLists.txt 31 │ │ ├── napi_init.cpp 32 │ ├── ets 33 │ │ ├── entryability 34 │ │ ├── entrybackupability 35 │ │ ├── pages 36 │ │ ├── Index.ets // 使用Node-API进行string相关开发示例代码 37 │ ├── module.json5 38 │ └── resources 39 ├── ohosTest 40 │ ├── ets 41 │ │ └── test 42 │ │ ├── Ability.test.ets 43 │ │ ├── NodeApiString.test.ets // 自动化测试代码 44 │ │ └── List.test.ets 45``` 46 47### 相关权限 48 49不涉及。 50 51### 依赖 52 53不涉及。 54 55### 约束与限制 56 571.本示例仅支持标准系统上运行, 支持设备:RK3568。 58 592.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。 60 613.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。 62 63### 下载 64 65如需单独下载本工程,执行如下命令: 66 67```` 68git init 69git config core.sparsecheckout true 70echo code/DocsSample/ArkTs/NodeAPI/NodeApiUse/NodeApiString > .git/info/sparse-checkout 71git remote add origin https://gitee.com/openharmony/applications_app_samples.git 72git pull origin master 73````