Skip to content

API Reference / api/form/ActionForm / ActionForm

Class: ActionForm

Defined in: api/form/ActionForm.d.ts:6

该类表示一个包含按钮的表单,允许玩家执行操作。

Extends

Constructors

new ActionForm()

ts
new ActionForm(): ActionForm

Defined in: api/form/ActionForm.d.ts:7

Returns

ActionForm

Overrides

ts
Form.constructor

Methods

addButton()

ts
addButton(
   text, 
   icon?, 
   callback?): this

Defined in: api/form/ActionForm.d.ts:33

添加按钮到表单中。

Parameters

text

Message

按钮的文本

icon?

string

图标图片的路径或URL

callback?

(player) => void

按钮点击时的回调函数

Returns

this

当前表单的引用。


getContent()

ts
getContent(): Message

Defined in: api/form/ActionForm.d.ts:15

获取表单的内容。

Returns

Message

表单的内容。


getTitle()

ts
getTitle(): string

Defined in: api/form/Form.d.ts:14

获取表单的标题。

Returns

string

表单的标题。

Inherited from

Form.getTitle


setContent()

ts
setContent(msg): this

Defined in: api/form/ActionForm.d.ts:23

设置表单的内容。

Parameters

msg

Message

要设置为表单内容的文字。

Returns

this

当前表单的引用。


setOnClose()

ts
setOnClose(on_close): this

Defined in: api/form/Form.d.ts:30

设置表单关闭时的回调函数。

Parameters

on_close

(player) => void

回调函数要设置为。

Returns

this

当前表单的引用。

Inherited from

Form.setOnClose


setOnSubmit()

ts
setOnSubmit(fn): this

Defined in: api/form/ActionForm.d.ts:67

设置表单提交时的回调函数。

Parameters

fn

(player, index) => void

回调函数。

Returns

this

当前表单的引用。


setTitle()

ts
setTitle(title): this

Defined in: api/form/Form.d.ts:22

设置表单的标题。

Parameters

title

string

要设置为表单的标题,可以是字符串或一个可翻译对象。

Returns

this

当前表单的引用。

Inherited from

Form.setTitle


toString()

ts
toString(): string

Defined in: api/form/ActionForm.d.ts:9

Returns a string representation of an object.

Returns

string