OtherLoginMethods.ets 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { BasicType } from 'basic'
  2. @Component
  3. export struct OtherLoginMethods {
  4. loginMethodArr: BasicType<undefined>[] = []
  5. build() {
  6. Column() {
  7. Text('其他登入方式')
  8. .fontSize($r('[basic].float.page_text_font_size_10'))
  9. .margin({ bottom: 16 })
  10. Row({ space: 16 }) {
  11. ForEach(this.loginMethodArr, (item: BasicType<undefined>) => {
  12. // LoginMethod(item)
  13. Image(item.src)
  14. .width(40)
  15. .aspectRatio(1)
  16. .borderRadius(20)
  17. .backgroundColor(Color.White)
  18. .onClick(item.click)
  19. })
  20. }
  21. }
  22. }
  23. }
  24. @Builder
  25. function LoginMethod(item: BasicType<undefined>) {
  26. Stack({ alignContent: Alignment.Start }) {
  27. Button(item.text)
  28. .border({ width: 1, color: $r('[basic].color.main_ac_color_dark') })
  29. .backgroundColor(Color.Transparent)
  30. .width('100%')
  31. .height(37)
  32. .fontSize($r('[basic].float.page_text_font_size_12'))
  33. .type(ButtonType.Normal)
  34. .fontColor($r('[basic].color.main_ac_color_dark'))
  35. .borderRadius(32)
  36. Image(item.src)
  37. .width(24)
  38. .height(24)
  39. .offset({ left: 12 })
  40. }
  41. .onClick(item.click)
  42. }