Skip to content

Commit 8db022e

Browse files
committed
🎨 Database template col type
1 parent 0df2bd7 commit 8db022e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

kernel/model/attribute_view.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,18 @@ func renderTemplateCol(blockID, tplContent string, rowValues []*av.KeyValues) st
5050

5151
buf := &bytes.Buffer{}
5252
ial := GetBlockAttrs(blockID)
53-
dataModel := map[string]string{} // 复制一份 IAL 以避免修改原始数据
53+
dataModel := map[string]interface{}{} // 复制一份 IAL 以避免修改原始数据
5454
for k, v := range ial {
5555
dataModel[strings.ReplaceAll(k, "custom-", "custom_")] = v
5656
}
5757
for _, rowValue := range rowValues {
5858
if 0 < len(rowValue.Values) {
59-
dataModel[rowValue.Key.Name] = rowValue.Values[0].String()
59+
v := rowValue.Values[0]
60+
if av.KeyTypeNumber == v.Type {
61+
dataModel[rowValue.Key.Name] = v.Number.Content
62+
} else {
63+
dataModel[rowValue.Key.Name] = v.String()
64+
}
6065
}
6166
}
6267
if err := tpl.Execute(buf, dataModel); nil != err {

0 commit comments

Comments
 (0)