2017-01-23 43 views
0

我正在玩完整日曆,我需要更改語言環境。使用完整日曆更改語言環境Jquery Widget

當我嘗試去做。我收到一個錯誤。

我必須添加哪些腳本才能消除錯誤?

Chrome瀏覽器開發 - 錯誤:

pt-br.js:1 Uncaught TypeError: Cannot read property 'datepickerLocale' of undefined 

我用:

HTML:

<div id='calendar'></div> 

JS:

<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/locale/pt-br.js"></script> 
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script> 
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css"> 
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.print.css"> 

<script type="text/javascript"> 
    $(document).ready(function() { 

    // page is now ready, initialize the calendar... 

    $('#calendar').fullCalendar({ 
     // put your options and callbacks here 
     locale: 'pt-br' 
    }) 

}); 

</script> 
+0

嘗試加載*加載後的區域文件* fullcalendar本身 –

+0

謝謝佩卡,這解決了我的問題。 –

+0

沒問題。我添加了一個答案,因爲這可能會出現在其他人可能通過谷歌搜索錯誤消息(並且現有的結果不適用於這種情況)中找到這個。 –

回答

0

我想在F無法正確調用日曆。它期望一個設置或選項對象。

嘗試調用它裏面的文件準備好對象,通過

(function($){ 
    $(function(){ 
     // rest of the code here 
    }) 
})(jQuery) 
+0

當我擺脫語言環境設置時,日曆顯示正常。我認爲這個問題是另一個地方。這是一個腳本故障問題。 –

1

區域設置文件需要fullcalendar是目前已經。

負載後裝載fullcalendar本身的語言環境文件