Bootstrap DateTimePicker安装/配置 [英] Bootstrap datetimepicker installation/configuration

查看:348
本文介绍了Bootstrap DateTimePicker安装/配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 eonasdan引导程序datetimepicker 的基本配置上遇到了一些问题.

I'm having some issues with a basic configuration of the eonasdan bootstrap datetimepicker.

我使用他们小提琴 eonasdan.github.io/bootstrap-datetimepicker/#minimum-setup"rel =" nofollow noreferrer>基本设置说明以显示我的配置.我在该主题上看到另一个 Stackoverflow问题,该问题还有另一个修饰与相同插件的旧版本.这两个小提琴看起来很相似,但我的却不起作用.

I created a fiddle using the code from their basic setup instructions to show my configuration. I see another Stackoverflow question on this topic that has another fiddle with older versions of the same plugins. The two fiddles look similar, but mine doesn't work.

<div class="container">
    <div class="row">
        <div class='col-sm-6'>
            <div class="form-group">
                <div class='input-group date' id='datetimepicker1'>
                    <input type='text' class="form-control" />
                    <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            $(function () {
                $('#datetimepicker1').datetimepicker();
            });
        </script>
    </div>
</div>

为什么我的提琴作品中没有日期时间选择器?

Why doesn't the datetime picker in my fiddle work?

推荐答案

如果在检查控制台时运行小提琴,则会看到以下错误:

If you run your fiddle while inspecting the console you will see the following error:

uncaught exception: bootstrap-datetimepicker requires Moment.js to be loaded first

因此,这仅仅是脚本加载顺序的问题. 是完全相同的提琴,只是最后载入了bootstrap-datetimepicker.min.js,而且有效.

So it's simply a matter of the order in which the scripts are loaded. This is exactly the same fiddle, except bootstrap-datetimepicker.min.js is loaded last, and it works.

只需按正确的顺序加载资源,或使用依赖项管理工具为您整理资源即可.

Just take care of loading the resources in the right order, or use a dependency management tool to sort it out for you.

这篇关于Bootstrap DateTimePicker安装/配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆