container.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VContainerBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VContainer(children ...h.HTMLComponent) (r *VContainerBuilder) {
  11. r = &VContainerBuilder{
  12. tag: h.Tag("v-container").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VContainerBuilder) Fluid(v bool) (r *VContainerBuilder) {
  17. b.tag.Attr(":fluid", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VContainerBuilder) Id(v string) (r *VContainerBuilder) {
  21. b.tag.Attr("id", v)
  22. return b
  23. }
  24. func (b *VContainerBuilder) Tag(v string) (r *VContainerBuilder) {
  25. b.tag.Attr("tag", v)
  26. return b
  27. }
  28. func (b *VContainerBuilder) SetAttr(k string, v interface{}) {
  29. b.tag.SetAttr(k, v)
  30. }
  31. func (b *VContainerBuilder) Attr(vs ...interface{}) (r *VContainerBuilder) {
  32. b.tag.Attr(vs...)
  33. return b
  34. }
  35. func (b *VContainerBuilder) Children(children ...h.HTMLComponent) (r *VContainerBuilder) {
  36. b.tag.Children(children...)
  37. return b
  38. }
  39. func (b *VContainerBuilder) AppendChildren(children ...h.HTMLComponent) (r *VContainerBuilder) {
  40. b.tag.AppendChildren(children...)
  41. return b
  42. }
  43. func (b *VContainerBuilder) PrependChildren(children ...h.HTMLComponent) (r *VContainerBuilder) {
  44. b.tag.PrependChildren(children...)
  45. return b
  46. }
  47. func (b *VContainerBuilder) Class(names ...string) (r *VContainerBuilder) {
  48. b.tag.Class(names...)
  49. return b
  50. }
  51. func (b *VContainerBuilder) ClassIf(name string, add bool) (r *VContainerBuilder) {
  52. b.tag.ClassIf(name, add)
  53. return b
  54. }
  55. func (b *VContainerBuilder) On(name string, value string) (r *VContainerBuilder) {
  56. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  57. return b
  58. }
  59. func (b *VContainerBuilder) Bind(name string, value string) (r *VContainerBuilder) {
  60. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  61. return b
  62. }
  63. func (b *VContainerBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  64. return b.tag.MarshalHTML(ctx)
  65. }