chore: 优化代码结构

This commit is contained in:
tangtanglove
2023-07-25 15:12:16 +08:00
parent 804727ecdd
commit 99702e0868
57 changed files with 270 additions and 251 deletions

View File

@@ -8,7 +8,8 @@ import (
"github.com/quarkcms/quark-go/v2/pkg/app/admin/component/form/fields/when"
"github.com/quarkcms/quark-go/v2/pkg/app/admin/component/form/rule"
"github.com/quarkcms/quark-go/v2/pkg/app/admin/component/table"
"github.com/quarkcms/quark-go/v2/pkg/utils"
"github.com/quarkcms/quark-go/v2/pkg/utils/convert"
"github.com/quarkcms/quark-go/v2/pkg/utils/hex"
)
type Option struct {
@@ -96,7 +97,7 @@ func (p *Component) Init() *Component {
// 设置Key
func (p *Component) SetKey(key string, crypt bool) *Component {
p.ComponentKey = utils.MakeKey(key, crypt)
p.ComponentKey = hex.Make(key, crypt)
return p
}
@@ -429,7 +430,7 @@ func (p *Component) SetWhen(value ...any) *Component {
i.Body = callback()
}
getOption := utils.InterfaceToString(option)
getOption := convert.AnyToString(option)
switch operator {
case "=":
i.Condition = "<%=String(" + p.Name + ") === '" + getOption + "' %>"