mirror of
https://github.com/quarkcloudio/quark-go.git
synced 2025-09-26 20:11:11 +08:00
chore: 优化代码
This commit is contained in:
@@ -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.
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user