Index.ets代码:
import { IndexModule } from '../view/IndexModule'; @Entry @Component struct Index { @State message: string = 'Hello World' build() { Row() { Column() { IndexModule({ moduleName:'hello'}) .margin({ top: 10 }) } .width('100%') } .height('100%') } }
IndexModule.ets的arkts代码:
@Component export struct IndexModule { private moduleName: string; build() { Column() { Text(this.moduleName + 'jieke') .fontSize(18) .fontWeight(FontWeight.Bolder) Text('hello') .fontWeight(FontWeight.Bold) Image($r('app.media.tiyu3')) .width(100) } } }
资源代码如下:
鸿蒙代码页面传递参数组件传递数据资源-优快云文库https://download.youkuaiyun.com/download/hashiqimiya/90557385