Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

按照文档写post服务,field := &builder.AdminField{}报错 #7

Closed
ArtfulCoderr opened this issue Apr 10, 2023 · 1 comment
Closed

Comments

@ArtfulCoderr
Copy link

// 字段
func (p *Post) Fields(ctx *builder.Context) []interface{} {

field := &builder.AdminField{}

return []interface{}{
	field.ID("id", "ID"),

	field.Text("title", "标题").
		SetRules(
			[]string{
				"required",
			},
			map[string]string{
				"required": "标题必须填写",
			},
		),

	field.Editor("content", "内容").OnlyOnForms(),

	field.Switch("status", "状态").
		SetTrueValue("正常").
		SetFalseValue("禁用").
		SetEditable(true).
		SetDefault(true),
}

}

@tangtanglove
Copy link
Collaborator

文档已修正,请查看最新文档

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants