Skip to content

Commit 4b5b24f

Browse files
JonathanGuncrispgm
authored andcommitted
fix: add Width to ButtonBlock
1 parent 696bf34 commit 4b5b24f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

card/button.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type ButtonBlock struct {
1212
value map[string]interface{}
1313
confirm *ConfirmBlock
1414
actionType string
15+
width string
1516
}
1617

1718
type buttonRenderer struct {
@@ -24,6 +25,7 @@ type buttonRenderer struct {
2425
Value map[string]interface{} `json:"value,omitempty"`
2526
Confirm Renderer `json:"confirm,omitempty"`
2627
ActionType string `json:"action_type,omitempty"`
28+
Width string `json:"width,omitempty"`
2729
}
2830

2931
// Render 渲染为 Renderer
@@ -38,6 +40,7 @@ func (b *ButtonBlock) Render() Renderer {
3840
Type: b.btnType,
3941
Value: b.value,
4042
ActionType: b.actionType,
43+
Width: b.width,
4144
}
4245
if b.multiURL != nil {
4346
ret.MultiURL = b.multiURL.Render()
@@ -65,6 +68,12 @@ func (b *ButtonBlock) ActionType(actionType string) *ButtonBlock {
6568
return b
6669
}
6770

71+
// Width 按钮的宽度
72+
func (b *ButtonBlock) Width(w string) *ButtonBlock {
73+
b.width = w
74+
return b
75+
}
76+
6877
// URL 按钮的跳转链接
6978
func (b *ButtonBlock) URL(u string) *ButtonBlock {
7079
b.url = u

0 commit comments

Comments
 (0)