chore: 优化代码

This commit is contained in:
tangtanglove
2024-04-06 17:36:41 +08:00
parent 5ca815f39a
commit 3e63677fc0
2 changed files with 3 additions and 3 deletions

View File

@@ -152,7 +152,7 @@ func (p *Template) Render(ctx *builder.Context) error {
if len(banners) > 0 {
swiperItems := []*swiper.Item{}
for _, banner := range banners {
swiperItems = append(swiperItems, p.SwiperItem(banner.SetStyle("width:100%;height:200px;")))
swiperItems = append(swiperItems, p.SwiperItem(banner))
}
components = append(components,
p.

View File

@@ -69,7 +69,7 @@ func (p *Template) Route() interface{} {
}
// 是否存在路由
func (p *Template) hasRouteMapping(method string, path string, handler func(ctx *Context) error) bool {
func (p *Template) hasRouteMapping(method string, path string) bool {
has := false
for _, v := range p.RouteMapping {
if v.Method == method && v.Path == path {
@@ -81,7 +81,7 @@ func (p *Template) hasRouteMapping(method string, path string, handler func(ctx
// 注册路由
func (p *Template) AddRouteMapping(method string, path string, handler func(ctx *Context) error) *Template {
if !p.hasRouteMapping(method, path, handler) {
if !p.hasRouteMapping(method, path) {
getRoute := &RouteMapping{
Method: method,
Path: path,