confirm
Description
调用一个确认消息框
confirm: (config: ConfirmBoxConfig | string | number) => HTMLElement
Parameters
config- (required) ConfirmBoxConfig | string | number - 要么是包含确认框配置的对象,要么是要显示的文本
Returns
div- (HTMLElement) - 确认框的 div 容器
Example
var box = gantt.confirm({
text: "Continue?",
ok:"Yes",
cancel:"No",
callback: function(result){
if(result){
gantt.message("Yes!");
}else{
gantt.message("No...");
}
}
});
// or
var box = gantt.confirm("Do you want to continue?");
Details
配置对象包括以下属性:
- id? - (number | string) - 可选,确认框的 ID
- text - (number | string) - 确认框主体的文本
- title? - (number | string) - 可选,头部文本
- ok? - (number | string) - 可选,"OK" 按钮的文本
- cancel? - (number | string) - 可选,"Cancel" 按钮的文本
- position? - (string) - 可选,目前仅支持一个值 - "top",其他值将导致显示为 "center-align"
- width? - (string) - 可选,确认框的宽度(以 CSS <length> 或 <percentage> 值设置,例如 "100px"、"50%")
- height? - (string) - 可选,确认框的高度(以 CSS <length> 或 <percentage> 值设置,例如 "100px"、"50%")
- callback? (result): void - 可选,在按钮点击时调用的函数。参数为 true 或 false,取决于所点击的按钮
- result - (boolean) - 点击按钮的结果:true 表示 "OK",false 表示 "Cancel"。
有关 confirm 消息框可用配置选项的更多详细信息,请参阅 弹出消息与模态框 文章。
Related API
Related Guides
Change log
- 新增于 4.0 版本
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.