Skip to content

table components.md

cg33 edited this page Aug 5, 2018 · 1 revision

图片组件

// 列显示配置
userTable.Info.FieldList = []FieldStruct{
    {
        Head:     "头像",
        Field:    "avatar",
        TypeName: "tinyint",
        ExcuFun: func(model RowModel) string {
            return components.GetImage().SetHeight("50")
                    .SetWidth("50").SetSrc(model.Value).GetContent()
        },
    },
}

标签组件

// 列显示配置
userTable.Info.FieldList = []FieldStruct{
    {
        Head:     "标签",
        Field:    "label",
        TypeName: "tinyint",
        ExcuFun: func(model RowModel) string {
            return components.Label.GetContent(model.Value)
        },
    },
}
Clone this wiki locally