tab.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VTabBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VTab(children ...h.HTMLComponent) (r *VTabBuilder) {
  11. r = &VTabBuilder{
  12. tag: h.Tag("v-tab").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VTabBuilder) ActiveClass(v string) (r *VTabBuilder) {
  17. b.tag.Attr("active-class", v)
  18. return b
  19. }
  20. func (b *VTabBuilder) Append(v bool) (r *VTabBuilder) {
  21. b.tag.Attr(":append", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VTabBuilder) Dark(v bool) (r *VTabBuilder) {
  25. b.tag.Attr(":dark", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VTabBuilder) Disabled(v bool) (r *VTabBuilder) {
  29. b.tag.Attr(":disabled", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VTabBuilder) Exact(v bool) (r *VTabBuilder) {
  33. b.tag.Attr(":exact", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VTabBuilder) ExactActiveClass(v string) (r *VTabBuilder) {
  37. b.tag.Attr("exact-active-class", v)
  38. return b
  39. }
  40. func (b *VTabBuilder) ExactPath(v bool) (r *VTabBuilder) {
  41. b.tag.Attr(":exact-path", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VTabBuilder) Href(v interface{}) (r *VTabBuilder) {
  45. b.tag.Attr(":href", h.JSONString(v))
  46. return b
  47. }
  48. func (b *VTabBuilder) Light(v bool) (r *VTabBuilder) {
  49. b.tag.Attr(":light", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VTabBuilder) Link(v bool) (r *VTabBuilder) {
  53. b.tag.Attr(":link", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VTabBuilder) Nuxt(v bool) (r *VTabBuilder) {
  57. b.tag.Attr(":nuxt", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VTabBuilder) Replace(v bool) (r *VTabBuilder) {
  61. b.tag.Attr(":replace", fmt.Sprint(v))
  62. return b
  63. }
  64. func (b *VTabBuilder) Ripple(v interface{}) (r *VTabBuilder) {
  65. b.tag.Attr(":ripple", h.JSONString(v))
  66. return b
  67. }
  68. func (b *VTabBuilder) Tag(v string) (r *VTabBuilder) {
  69. b.tag.Attr("tag", v)
  70. return b
  71. }
  72. func (b *VTabBuilder) Target(v string) (r *VTabBuilder) {
  73. b.tag.Attr("target", v)
  74. return b
  75. }
  76. func (b *VTabBuilder) To(v interface{}) (r *VTabBuilder) {
  77. b.tag.Attr(":to", h.JSONString(v))
  78. return b
  79. }
  80. func (b *VTabBuilder) SetAttr(k string, v interface{}) {
  81. b.tag.SetAttr(k, v)
  82. }
  83. func (b *VTabBuilder) Attr(vs ...interface{}) (r *VTabBuilder) {
  84. b.tag.Attr(vs...)
  85. return b
  86. }
  87. func (b *VTabBuilder) Children(children ...h.HTMLComponent) (r *VTabBuilder) {
  88. b.tag.Children(children...)
  89. return b
  90. }
  91. func (b *VTabBuilder) AppendChildren(children ...h.HTMLComponent) (r *VTabBuilder) {
  92. b.tag.AppendChildren(children...)
  93. return b
  94. }
  95. func (b *VTabBuilder) PrependChildren(children ...h.HTMLComponent) (r *VTabBuilder) {
  96. b.tag.PrependChildren(children...)
  97. return b
  98. }
  99. func (b *VTabBuilder) Class(names ...string) (r *VTabBuilder) {
  100. b.tag.Class(names...)
  101. return b
  102. }
  103. func (b *VTabBuilder) ClassIf(name string, add bool) (r *VTabBuilder) {
  104. b.tag.ClassIf(name, add)
  105. return b
  106. }
  107. func (b *VTabBuilder) On(name string, value string) (r *VTabBuilder) {
  108. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  109. return b
  110. }
  111. func (b *VTabBuilder) Bind(name string, value string) (r *VTabBuilder) {
  112. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  113. return b
  114. }
  115. func (b *VTabBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  116. return b.tag.MarshalHTML(ctx)
  117. }