fix: 修复多图控件空值问题

修复多图控件空值问题
This commit is contained in:
yaoyilin
2022-11-10 16:22:03 +08:00
parent c5b68da18d
commit 30f85a6d20

View File

@@ -10,7 +10,6 @@ import (
"fmt" "fmt"
"gitlab.52pay.top/go/easygoadmin/utils/gconv" "gitlab.52pay.top/go/easygoadmin/utils/gconv"
"html/template" "html/template"
"reflect"
"strings" "strings"
) )
@@ -249,11 +248,13 @@ func Album(param string, data interface{}, exts string, size int) template.HTML
} }
</style>` </style>`
var list []string var list []string
switch reflect.ValueOf(data).Kind() { switch data.(type) {
case reflect.Slice: case []string:
list = data.([]string) list = data.([]string)
default: case string:
list = strings.Split(data.(string), ",") if data.(string) != "" {
list = strings.Split(data.(string), ",")
}
} }
// 上传控件拼接 // 上传控件拼接
for _, v := range list { for _, v := range list {