在 FullCalendar 的标题上放置一个图标

Des*_*ERP 4 fullcalendar font-awesome

我在 FullCalendar 的标题上放置了一个 CustomButton,但我需要放置一个字体很棒的图标。

           customButtons: {
                btnBloquearAgenda: {
                    icon: 'fa fa-lock',
                    click: function() {
                        alert('clicked the custom button!');
                    }
                }
            },

            header: {
                left: 'prev,next',
                center: 'title',
                right: 'btnBloquearAgenda agendaDay,agendaWeek,month'
            },
Run Code Online (Sandbox Code Playgroud)

该按钮显示“未定义”。

小智 5

图标值附加到'fc-icon-'并作为类添加到按钮的span元素,即

            btnBloquearAgenda: {
                icon: 'fa fa-lock',
                click: function() {
                    alert('clicked the custom button!');
                }
            }
Run Code Online (Sandbox Code Playgroud)

会导致

<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa-lock"></span>
</button>
Run Code Online (Sandbox Code Playgroud)

我的解决方法是在图标值中添加一个额外的“fa”

       customButtons: {
            btnBloquearAgenda: {
                icon: 'fa fa fa-lock',
                click: function() {
                    alert('clicked the custom button!');
                }
            }
        },

        header: {
            left: 'prev,next',
            center: 'title',
            right: 'btnBloquearAgenda agendaDay,agendaWeek,month'
        },
Run Code Online (Sandbox Code Playgroud)

结果:

<button type="button" class="fc-btnBloquearAgenda-button fc-button fc-state-default fc-corner-right">
<span class="fc-icon fc-icon-fa fa fa-lock"></span>
</button>
Run Code Online (Sandbox Code Playgroud)