首页 > 解决方案 > 带有 API/props 的完整日历集 dayNames

问题描述

我正在使用 Fullcalender 的 Vue 组件,但找不到更改默认日期名称的选项。

https://fullcalendar.io/docs/v3/dayNames

我试图通过这样的道具:

<FullCalendar
   :option="{
     dayNames:[
     'Sunday',
     'Monday', 
     'Tuesday', 
     'Wednesday',
     'Thursday', 
     'Friday', 
     'Saturday'
   ]}"
/>

或者

<FullCalendar
   :dayNames="['Sunday',
            'Monday', 'Tuesday', 'Wednesday',
            'Thursday', 'Friday', 'Saturday']"
/>

但它没有用。我不知道如何将它们传递给组件。

标签: vue.jsfullcalendar

解决方案


我使用 jQuery 制作了一个快速函数来执行此操作:

var headerElems = $('.fc-day-header');

if (headerElems.length > 0) {

    headerElems.each((k, v) => {

        var text = $('span', v).text();

        // set first chart as text
        $('span', v).text(text[0]);

    });

}

推荐阅读