已解决
基于DevEco Studio的OpenHarmony应用原子化服务(元服务)入门教程
来自网友在路上 183883提问 提问时间:2023-11-10 04:58:45阅读次数: 83
最佳答案 问答题库838位专家为你答疑解惑
一、创建项目
二、创建卡片
三、应用服务代码
Index.ets
@Entry
@Component
struct Index {@State TITLE: string = 'OpenHarmony';@State CONTEXT: string = '创新召见未来!';build() {Row() {Column() {Text(this.TITLE).fontSize(30).fontColor(0xFEFEFE).fontWeight(600)Text(this.CONTEXT).fontSize(30).fontColor(0xFEFEFE).fontWeight(600).margin(20)}.width('100%')}.width('100%').height('100%').backgroundColor(0x42218c)}
}
四、卡片代码
WidgetNewCard.ets
@Entry
@Component
struct WidgetNewCard {/** The title.*/readonly TITLE: string = 'OpenHarmony';readonly CONTEXT: string = '技术构建万物智联';/** The action type.*/readonly ACTION_TYPE: string = 'router';/** The ability name.*/readonly ABILITY_NAME: string = 'EntryAbility';/** The message.*/readonly MESSAGE: string = 'add detail';/** The with percentage setting.*/readonly FULL_WIDTH_PERCENT: string = '100%';/** The height percentage setting.*/readonly FULL_HEIGHT_PERCENT: string = '100%';build() {Row() {Column() {Text(this.TITLE).fontSize(14).fontColor(0xFEFEFE).fontWeight(600)Text(this.CONTEXT).fontSize(14).fontColor(0xFEFEFE).fontWeight(600)}.width(this.FULL_WIDTH_PERCENT)}.backgroundColor(0x42218c).height(this.FULL_HEIGHT_PERCENT).onClick(() => {postCardAction(this, {"action": this.ACTION_TYPE,"abilityName": this.ABILITY_NAME,"params": {"message": this.MESSAGE}});})}
}
五、运行案例
六、案例卡片效果
注释说明:
现最新版的DevEco Studio中OpenHarmony项目在本目录下调整。将runtimeOS:””中间内容调为OpenHarmony即可。这种方式,不用开发板,通过预览器就可以查看项目样式效果。
完整项目代码地址:
HarmonyOSAPP开发相关组件: 深圳市蛟龙腾飞网络科技有限公司 - Gitee.com
查看全文
99%的人还看了
相似问题
- C++(11):原子类型的is_lock_free/is_always_lock_free
- UnoCss(原子化css引擎) 让你的开发更轻松愉快
- GoLong的学习之路(二十三)进阶,语法之并发(go最重要的特点)(锁,sync包,原子操作)
- (二)正点原子I.MX6ULL u-boot移植
- 基于DevEco Studio的OpenHarmony应用原子化服务(元服务)入门教程
- 正点原子嵌入式linux驱动开发——Linux WIFI驱动
- springboot整合redis+lua实现getdel操作保证原子性
- HarmonyOS鸿蒙原生应用开发设计- 元服务(原子化服务)图标
- 正点原子嵌入式linux驱动开发——Linux 音频驱动
- 正点原子嵌入式linux驱动开发——Linux CAN驱动
猜你感兴趣
版权申明
本文"基于DevEco Studio的OpenHarmony应用原子化服务(元服务)入门教程":http://eshow365.cn/6-36903-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!