mirror of
https://github.com/quarkcloudio/quark-go.git
synced 2025-09-26 20:11:11 +08:00
38 lines
709 B
Go
38 lines
709 B
Go
package actions
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/quarkcms/quark-go/pkg/builder"
|
|
"github.com/quarkcms/quark-go/pkg/builder/actions"
|
|
)
|
|
|
|
type EditLink struct {
|
|
actions.Link
|
|
}
|
|
|
|
// 初始化
|
|
func (p *EditLink) Init(name string) *EditLink {
|
|
// 初始化父结构
|
|
p.ParentInit()
|
|
|
|
// 设置按钮类型,primary | ghost | dashed | link | text | default
|
|
p.Type = "link"
|
|
|
|
// 设置按钮大小,large | middle | small | default
|
|
p.Size = "small"
|
|
|
|
// 文字
|
|
p.Name = name
|
|
|
|
// 设置展示位置
|
|
p.SetOnlyOnIndexTableRow(true)
|
|
|
|
return p
|
|
}
|
|
|
|
// 跳转链接
|
|
func (p *EditLink) GetHref(request *builder.Request) string {
|
|
return "#/index?api=" + strings.Replace(request.Path(), "/index", "/edit&id=${id}", -1)
|
|
}
|