default
This commit is contained in:
parent
587e29ccd9
commit
79dd16de58
|
|
@ -24,6 +24,7 @@ type Form struct {
|
||||||
Name string `json:"name"` //表单名称
|
Name string `json:"name"` //表单名称
|
||||||
Key string `json:"key"` //表单KEY
|
Key string `json:"key"` //表单KEY
|
||||||
Value interface{} `json:"value"` //表单值
|
Value interface{} `json:"value"` //表单值
|
||||||
|
Default interface{} `json:"default"` //默认值
|
||||||
Disable bool `json:"disable,omitempty"` //是否禁用
|
Disable bool `json:"disable,omitempty"` //是否禁用
|
||||||
Tips string `json:"tips"` //表单提示
|
Tips string `json:"tips"` //表单提示
|
||||||
Option []*FormOption `json:"option"` //表单选项,radio和checkbox需要
|
Option []*FormOption `json:"option"` //表单选项,radio和checkbox需要
|
||||||
|
|
@ -50,6 +51,8 @@ func NewFroms(tplConfig, saveConfig string) ([]*Form, error) {
|
||||||
for _, form := range forms {
|
for _, form := range forms {
|
||||||
if _, ok := cfg[form.Key]; ok {
|
if _, ok := cfg[form.Key]; ok {
|
||||||
form.Value = cfg[form.Key]
|
form.Value = cfg[form.Key]
|
||||||
|
} else {
|
||||||
|
form.Value = form.Default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return forms, err
|
return forms, err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue