mirror of
https://github.com/quarkcloudio/quark-go.git
synced 2025-09-26 20:11:11 +08:00
feat: table toolbar 支持menu配置
This commit is contained in:
17
pkg/app/admin/template/resource/resolves_toolbar.go
Normal file
17
pkg/app/admin/template/resource/resolves_toolbar.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package resource
|
||||
|
||||
import (
|
||||
"github.com/quarkcloudio/quark-go/v2/pkg/app/admin/template/resource/types"
|
||||
"github.com/quarkcloudio/quark-go/v2/pkg/builder"
|
||||
)
|
||||
|
||||
// 列表工具栏
|
||||
func (p *Template) IndexTableMenus(ctx *builder.Context) interface{} {
|
||||
|
||||
// 模版实例
|
||||
template := ctx.Template.(types.Resourcer)
|
||||
|
||||
menus := template.Menus(ctx)
|
||||
|
||||
return menus
|
||||
}
|
@@ -201,6 +201,11 @@ func (p *Template) Actions(ctx *builder.Context) []interface{} {
|
||||
return []interface{}{}
|
||||
}
|
||||
|
||||
// 菜单
|
||||
func (p *Template) Menus(ctx *builder.Context) interface{} {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
|
||||
// 数据导出前回调
|
||||
func (p *Template) BeforeExporting(ctx *builder.Context, list []map[string]interface{}) []interface{} {
|
||||
result := []interface{}{}
|
||||
|
@@ -18,7 +18,8 @@ func (p *Template) IndexTableToolBar(ctx *builder.Context) interface{} {
|
||||
return (&table.ToolBar{}).
|
||||
Init().
|
||||
SetTitle(p.IndexTableTitle(ctx)).
|
||||
SetActions(p.IndexTableActions(ctx))
|
||||
SetActions(p.IndexTableActions(ctx)).
|
||||
SetMenu(p.IndexTableMenus(ctx))
|
||||
}
|
||||
|
||||
// 列表标题
|
||||
|
@@ -153,6 +153,9 @@ type Resourcer interface {
|
||||
// 行为
|
||||
Actions(ctx *builder.Context) []interface{}
|
||||
|
||||
// 菜单
|
||||
Menus(ctx *builder.Context) interface{}
|
||||
|
||||
// 创建行为组件
|
||||
BuildAction(ctx *builder.Context, item interface{}) interface{}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user