fix xiang.table.export bug

This commit is contained in:
Max 2022-04-14 19:14:45 +08:00
parent 2926ec99f5
commit 4d497dd980

View file

@ -12,6 +12,7 @@ import (
"github.com/xuri/excelize/v2"
"github.com/yaoapp/gou"
"github.com/yaoapp/gou/helper"
"github.com/yaoapp/kun/any"
"github.com/yaoapp/kun/exception"
"github.com/yaoapp/kun/log"
"github.com/yaoapp/kun/maps"
@ -303,6 +304,10 @@ func (table *Table) Export(filename string, data interface{}, page int, chunkSiz
for _, row := range values {
rows = append(rows, maps.Of(row).Dot())
}
} else if values, ok := data.([]interface{}); ok {
for _, row := range values {
rows = append(rows, any.Of(row).MapStr().Dot())
}
}
columns, err := table.exportSetting()