2017-02-06 62 views
0

我嘗試在果園CMS v如果使用自舉的DateTimePicker 1.10 我添加的文件果園CMS使用自舉的DateTimePicker

引導-datetimepicker.js,

引導-datetimepicker.min.js,

自舉datetimepicker.css,

引導-datetimepicker.min.css,

我坐落在科爾文件ECT地方,* .js文件的腳本文件夾設置和*的CSS樣式中的文件夾

設置和構建ResourceManifest類

public class ResourceManifest : IResourceManifestProvider 
    { 
     public void BuildManifests(ResourceManifestBuilder builder) 
     { 
      var manifest = builder.Add(); 
      manifest.DefineScript("bootstrap_datetimepicker").SetUrl("bootstrap-datetimepicker.min.js", "bootstrap-datetimepicker.js"); 
      manifest.DefineStyle("bootstrap_datetimepicker").SetUrl("bootstrap-datetimepicker.min.css", "bootstrap-datetimepicker.css"); 

     } 
    } 

在查看我添加以下代碼來測試,但它不工作

@ {

Script.Require("Bootstrap").AtFoot(); 
Script.Require("bootstrap_datetimepicker").AtFoot(); 
Style.Require("Bootstrap").AtHead(); 
Style.Require("bootstrap_datetimepicker").AtHead(); 

}

<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> 

@using (Script.Foot()) 
{ 

    <script type="text/javascript"> 

     //<![CDATA[ 

     $(function() { 


      $('#datetimepicker1').datetimepicker(); 

     }); 



     //]]> 
    </script> 
} 

回答

0

必須添加moment.js到腳本文件夾和更新由ResourceManifest添加

manifest.DefineScript("moment").SetUrl("moment.min.js", "moment.js"); 

,並查看剛纔

調用它,它正在

enter image description here