小编Mar*_*nce的帖子

如何自定义Bootbox.js提示选项

我试图自定义bootboxjs.prompt选项,但它似乎不允许选项对象作为参数

这是来自http://bootboxjs.com/index.html#api的示例

bootbox.prompt("What is your name?", function(result) {                
  if (result === null) {                                             
    Example.show("Prompt dismissed");                              
  } else {
    Example.show("Hi <b>"+result+"</b>");                          
  }
});
Run Code Online (Sandbox Code Playgroud)

这就是我想要传递的内容:

var promptOptions = {
  title: "Custom label",
  buttons: {
    confirm: {
      label: "Save"
    }
  }
};

bootbox.prompt(promptOptions, function(result) {                
  if (result === null) {                                             
    console.log("Prompt dismissed");                              
  } else {
    console.log("Hi "+result);                          
  }
});
Run Code Online (Sandbox Code Playgroud)

如何自定义标题和按钮标签?

bootbox

12
推荐指数
2
解决办法
4万
查看次数

标签 统计

bootbox ×1