bootboxjs 无效的提示类型 - 文档中的示例不起作用

bootboxjs invalid prompt type - example from documentation doesn't work

我正在尝试在我的项目中使用 http://bootboxjs.com/examples.html#bb-prompt,所以我很自然地开始使用他们的示例代码来查看它是否 运行s.

根据文档;我正在使用最新的 bootstrap、jquery 和 bootstrap js,然后加载 bootboxjs。这是我正在尝试的代码 运行:

bootbox.prompt({
    title: "This is a prompt with a set of radio inputs!",
    message: '<p>Please select an option below:</p>',
    inputType: 'radio',
    inputOptions: [
    {
        text: 'Choice One',
        value: '1',
    },
    {
        text: 'Choice Two',
        value: '2',
    },
    {
        text: 'Choice Three',
        value: '3',
    }
    ],
    callback: function (result) {
        console.log(result);
    }
});

这段代码执行时;我收到此错误:

Uncaught Error: invalid prompt type

这是一个非常棒的库,我很乐意在我的项目中使用它;但我有点难过。有什么想法吗?

我已经解决了这个问题。我最初只使用 bootbox.min.js 但事实证明我还需要使用 bootbox.locales.min.js。我应该 rtfm...

此外,我使用 webpack(通过 laravel-mix)将所有库捆绑到一个 .js 文件中,因此使用 bootbox.all.min.js(使用语言环境的生产构建)作为我最后一件事负载似乎也有帮助。

这是适合我的 webpack.mix.js 配置文件:

const mix = require('laravel-mix');

mix
    .copyDirectory('resources/libs/font-awesome/fonts', 'public/fonts')
    .styles(
        [
            // snipped...
        ],
        'public/css/app.css'
    )
    .scripts(
        [
            'resources/libs/jquery/jquery-3.4.1.min.js',
            'resources/libs/bootstrap/bootstrap.bundle.min.js',
            // bunch of other js libs...
            'resources/libs/bootbox/bootbox.all.min.js',
        ],
        'public/js/app.js'
    );