YtButton.ets 752 B

1234567891011121314151617181920212223242526272829
  1. @Component
  2. export struct YtButton {
  3. btHeight: Length = 37
  4. btWidth: Length = '100%'
  5. btContent: string = ''
  6. click = () => {
  7. }
  8. btPadding?: Length | Padding
  9. btFontSize: number = 12
  10. bgc: ResourceColor = $r('app.color.main_ac_color_dark')
  11. btFontColor: ResourceColor = Color.White
  12. btBorder?: BorderOptions
  13. btState: boolean = true
  14. build() {
  15. Button(this.btContent)
  16. .buttonStyle(ButtonStyleMode.NORMAL)
  17. .fontSize($r(`app.float.page_text_font_size_${this.btFontSize}`))
  18. .fontColor(this.btFontColor)
  19. .backgroundColor(this.bgc)
  20. .height(this.btHeight)
  21. .width(this.btWidth)
  22. .onClick(this.click)
  23. .padding(this.btPadding ?? {})
  24. .border(this.btBorder)
  25. .enabled(this.btState)
  26. }
  27. }