page.go 919 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package e12_hello_vuetify_grid
  2. import (
  3. "fmt"
  4. . "github.com/qor5/ui/vuetify"
  5. "github.com/qor5/web"
  6. h "github.com/theplant/htmlgo"
  7. )
  8. func HelloVuetifyGrid(ctx *web.EventContext) (pr web.PageResponse, err error) {
  9. row := func(col int, count int, color string) (r []h.HTMLComponent) {
  10. for i := 0; i < count; i++ {
  11. r = append(r, VFlex(
  12. VCard(
  13. VCardText(h.Text(fmt.Sprint(col))),
  14. ).Dark(true).Color(color),
  15. ).Col(Xs, col))
  16. }
  17. return
  18. }
  19. var lc []h.HTMLComponent
  20. lc = append(lc, row(12, 1, "primary")...)
  21. lc = append(lc, row(6, 2, "secondary")...)
  22. lc = append(lc, row(4, 3, "primary")...)
  23. lc = append(lc, row(3, 4, "secondary")...)
  24. lc = append(lc, row(2, 6, "primary")...)
  25. lc = append(lc, row(1, 12, "secondary")...)
  26. pr.Body = VApp(
  27. VMain(
  28. VContainer(
  29. VLayout(
  30. lc...,
  31. ).Row(true).Wrap(true),
  32. ).GridList(Md).TextAlign(Xs, Center),
  33. ),
  34. ).Id("mainapp")
  35. return
  36. }