Ver Fonte

only add VDivider when have children

Azuma Daisuke há 1 ano atrás
pai
commit
5ec44bdaa2
1 ficheiros alterados com 13 adições e 1 exclusões
  1. 13 1
      vuetifyx/card.go

+ 13 - 1
vuetifyx/card.go

@@ -59,9 +59,21 @@ func (b *CardBuilder) Outlined(v bool) (r *CardBuilder) {
 
 func (b *CardBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
 	var sb h.HTMLComponent
+	var hr h.HTMLComponent
 	if len(b.systemBar) > 0 {
 		sb = v.VSystemBar(b.systemBar...).Class("mx-2 pt-4").Color("white").Height(32)
 	}
+	if len(b.children) > 0 {
+		empty := true
+		for _, c := range b.children {
+			if c != nil {
+				empty = false
+			}
+		}
+		if !empty {
+			hr = v.VDivider()
+		}
+	}
 
 	return v.VCard(
 		sb,
@@ -69,6 +81,6 @@ func (b *CardBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
 			v.VToolbarTitle("").Children(b.header...),
 			v.VSpacer(),
 		).Flat(true).AppendChildren(b.actions...),
-		v.VDivider(),
+		hr,
 	).Outlined(b.outlined).Class(b.classNames...).AppendChildren(b.children...).MarshalHTML(ctx)
 }