什么是组件
组件是独立的代码块,具有特定功能和样式,并且可以在页面中独立使用和重复使用。ArkUI为开发者提供了可以直接在程序中使用的组件,通过组件可以快速构建UI,提高UI的开发效率和一致性。
组件的基本使用方法
下面列举一些AkU中常用的通用属性和通用事件

ok按钮

按钮部分:
Button('ok')
.onClick(() => {
this.message='你点击了ok按钮'
console.log('点击了ok按钮');
})
.width('80%')
.height(48)
.borderRadius(10)
.fontSize(16)
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.margin({ bottom: 50 })