2014-12-08 137 views
-1

我研究在互聯網上的日期選擇器,發現這個代碼,日期選擇器Laravel引導

 {{ Form::label('dateA','Date Aquired')}} 
     {{ Form::text('startingDate', null, array('class' => 'form-control input-sm','placeholder' => 'Starting Date','data-provide' => 'datepicker')) }} 

很多評論說,這個代碼工作,但我不是,它只是輸出texbox。在使用datepicker時,我需要包含一些腳本或css嗎?謝謝。

+0

http://eonasdan.github.io/bootstrap-datetimepicker/ – skv 2014-12-08 02:18:51

回答

1

您需要包含bootstrap,jquery,moment.js和您嘗試使用的特定日期選擇器的腳本和樣式表。

有安裝說明操作:

https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Installation

特別是這部分:

<script type="text/javascript" src="/path/to/jquery.js"></script> 
<script type="text/javascript" src="/path/to/moment.js"></script> 
<script type="text/javascript" src="/path/to/bootstrap/js/transition.js"></script> 
<script type="text/javascript" src="/path/to/bootstrap/js/collapse.js"></script> 
<script type="text/javascript" src="/path/to/bootstrap/dist/bootstrap.min.js"></script> 
<script type="text/javascript" src="/path/to/bootstrap-datetimepicker.min.js"></script> 

如果您正在使用刀片模板,你可以做你的URL是這樣的:

<link rel="stylesheet" href="{{ asset('css/bootstrap/bootstrap.min.css') }}"/> 

...其中文件夾css在您的public文件夾中。

有了這許多依賴關係,它可能是值得的,學習bower並使用上述鏈接的涼亭說明。