当前位置: 首页 > web >正文

鸿蒙代码@Builder

#代码如下:


@Entry
@Component
struct CardExample {@State title: string = "欢迎使用鸿蒙";@State content: string = "这是一段自定义内容";build() {Column() {this.MyCard({ title: this.title, content: this.content })}.padding(20)}@BuilderMyCard(props: { title: string, content: string }) {Column() {Text(props.title).fontSize(20).fontWeight(FontWeight.Bold).margin({ bottom: 10 })Text(props.content).fontSize(16).textAlign(TextAlign.Start)}.padding(20).backgroundColor(Color.White).borderRadius(10).shadow({ radius: 10, color: '#00000033', offsetX: 0, offsetY: 4 })}
}

运行结果:

http://www.xdnf.cn/news/2204.html

相关文章:

  • 关于调度策略的系统性解析与物流机器人应用实践
  • Universal Value Function Approximators 论文阅读(强化学习,迁移?)
  • 介绍常用的退烧与消炎药
  • 【Flume 】Windows安装步骤、配置环境
  • Llama factory如何全参数微调 Qwen2.5-7B-Instruct 模型并导入Ollama推理(详细版)
  • 大一下第一次考核题解
  • Linux文件目录操作实战
  • 【C++】15. 模板进阶
  • 【含文档+PPT+源码】基于Python的美食数据的设计与实现
  • llama factory 命令行推理流程
  • MUC基本知识
  • 电子电器架构 --- 乘用车电气/电子架构开发的关键挑战与应对策略
  • Shell编程之正则表达式
  • c++弹窗
  • threejs 零基础学习day01
  • 【补题】Codeforces Global Round 20 F1. Array Shuffling
  • Python循环中断:break和continue,循环else语法,综合案例
  • 一、人类社会结构的根本逻辑
  • Cribl 上传lookup 表,传入数据进event
  • 计算机网络的五层结构(物理层、数据链路层、网络层、传输层、应用层)到底是什么?
  • 揭开人工智能的神秘面纱:从概念到人工神经网络
  • Spring和Spring Boot集成MyBatis的完整对比示例,包含从项目创建到测试的全流程代码
  • 数据库系统概论(四)关系操作,关系完整性与关系代数
  • springboot集成MyBatis Generator快速开发
  • Pygame跨平台打包:将游戏发布到Windows、Mac和Linux
  • 当JIT遇见K8s
  • 如何下载VSCode插件市场为VSIX文件
  • 在Mybatis中为什么要同时指定扫描mapper接口和 mapper.xml 文件,理论单独扫描 xml 文件就可以啊
  • Maven进阶知识
  • 【TypeScript】速通篇