鸿蒙-ArkUI-自定义组件
myComonent({ title: '列表' })自定义构建函数,可以定义在全局或组件内。// 继承模式只能在全局。// 全局公共样式函数。
·
自定义组件
@component
struct MyComponent {
private title:string
build(){
Text(this.title)
}
}
引用组件
@Entry
@Component
struct ItemPage {
build() {
myComonent({ title: '列表' })
}
}
自定义构建函数,可以定义在全局或组件内
// 全局公共样式函数
@Styles function fillScreen(){
.width('100%')
.height('100%')
.backgroundColor('#EFEFEF')
.padding(20)
}
// 继承模式只能在全局
@Extend(Text) function priceText(){
.fontColor('#F36')
.fontSize(18)
}更多推荐



所有评论(0)