page.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package e24_vuetify_components_linkage_select
  2. // @snippet_begin(VuetifyComponentsLinkageSelect)
  3. import (
  4. . "github.com/qor5/ui/vuetify"
  5. vx "github.com/qor5/ui/vuetifyx"
  6. "github.com/qor5/web"
  7. "github.com/theplant/htmlgo"
  8. )
  9. func VuetifyComponentsLinkageSelect(ctx *web.EventContext) (pr web.PageResponse, err error) {
  10. labels := []string{
  11. "Province",
  12. "City",
  13. "District",
  14. }
  15. items := [][]*vx.LinkageSelectItem{
  16. {
  17. {ID: "1", Name: "浙江", ChildrenIDs: []string{"1", "2"}},
  18. {ID: "2", Name: "江苏", ChildrenIDs: []string{"3", "4"}},
  19. },
  20. {
  21. {ID: "1", Name: "杭州", ChildrenIDs: []string{"1", "2"}},
  22. {ID: "2", Name: "宁波", ChildrenIDs: []string{"3", "4"}},
  23. {ID: "3", Name: "南京", ChildrenIDs: []string{"5", "6"}},
  24. {ID: "4", Name: "苏州", ChildrenIDs: []string{"7", "8"}},
  25. },
  26. {
  27. {ID: "1", Name: "拱墅区"},
  28. {ID: "2", Name: "西湖区"},
  29. {ID: "3", Name: "镇海区"},
  30. {ID: "4", Name: "鄞州区"},
  31. {ID: "5", Name: "鼓楼区"},
  32. {ID: "6", Name: "玄武区"},
  33. {ID: "7", Name: "常熟区"},
  34. {ID: "8", Name: "吴江区"},
  35. },
  36. }
  37. pr.Body = VContainer(
  38. htmlgo.H3("Basic"),
  39. vx.VXLinkageSelect().Items(items...).Labels(labels...),
  40. htmlgo.H3("SelectOutOfOrder"),
  41. vx.VXLinkageSelect().Items(items...).Labels(labels...).SelectOutOfOrder(true),
  42. htmlgo.H3("Chips"),
  43. vx.VXLinkageSelect().Items(items...).Labels(labels...).Chips(true),
  44. htmlgo.H3("Row"),
  45. vx.VXLinkageSelect().Items(items...).Labels(labels...).Row(true),
  46. )
  47. return pr, nil
  48. }
  49. var VuetifyComponentsLinkageSelectPB = web.Page(VuetifyComponentsLinkageSelect)
  50. const VuetifyComponentsLinkageSelectPath = "/samples/vuetify-components-linkage-select"
  51. // @snippet_end