Skip to content

Commit 2cbdde0

Browse files
Update README.md
1 parent 57c1257 commit 2cbdde0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
- Android
4242
- iOS
43+
- Harmony
4344

4445
## 核心概念
4546

@@ -187,6 +188,53 @@ UIView *view = [TheGXTemplateEngine creatViewByTemplateItem:item measureSize:siz
187188
[self.view addSubview:view];
188189
```
189190

191+
### Harmony
192+
193+
#### 依赖管理
194+
在oh-package.json5文件中中添加依赖
195+
```
196+
// 依赖
197+
"dependencies": {
198+
"GaiaxHarmony": "",
199+
}
200+
```
201+
202+
#### 模板文件
203+
在项目rawfile目录
204+
```
205+
// 用于存放模板资源的路径
206+
src/main/resouces/rawfile/xxxx
207+
```
208+
209+
#### 调用方式
210+
```
211+
// SDK使用方式
212+
213+
// 引入头文件
214+
import { GXTemplateItem } from 'GaiaxHarmony/src/main/ets/context/GXTemplateItem';
215+
import { GXTemplateData } from 'GaiaxHarmony/src/main/ets/context/GXTemplateData';
216+
import { GXComponent } from 'GaiaxHarmony/src/main/ets/components/GXComponent';
217+
import { Size } from 'gxstretch';
218+
219+
// 构建模板参数 - 模板信息
220+
templateItem = new GXTemplateItem('bizId', 'templateId', 'templateVersion')
221+
222+
// 构建模板参数 - 模板数据
223+
templateData = new GXTemplateData();
224+
templateData.data = @{@"xxx": @"xxx"};
225+
226+
// 构建模板参数 - 视口大小(模板绘制尺寸)
227+
measureSize: Size<number> = new Size(NaN, NaN);
228+
229+
// 创建模板视图
230+
GXComponent({
231+
templateItem: this.templateItem,
232+
templateData: this.templateData,
233+
measureSize: this.measureSize
234+
})
235+
236+
```
237+
190238
## 2024鸿蒙迭代路线图
191239

192240
![image](https://github.com/alibaba/GaiaX/assets/6761107/2ea4f5f0-9fee-4c79-8aad-66114dcc893f)

0 commit comments

Comments
 (0)