当应用程序 css 和 javascript 标签在 Rails 上初始化时,fullcalendar 标题工具栏按钮不显示

2024-04-19

我想在我的 Rails 项目上运行 fullcalendar。我正在按照以下步骤操作https://github.com/bokmann/fullcalendar-rails https://github.com/bokmann/fullcalendar-rails但我有一个错误。

日历仅在此视图中正确显示http://fullcalendar.io/js/fullcalendar-2.2.6/demos/basic-views.html http://fullcalendar.io/js/fullcalendar-2.2.6/demos/basic-views.html当我像这样从 application.html.erb 页面调用所有内容时

<!DOCTYPE html>
<html>
<head>

  <title>LetsScheduleComMy</title>
  <%= csrf_meta_tags %>
  <meta charset='utf-8' />
  <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
  <meta name="apple-mobile-web-app-capable" content="yes" /> 
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
  <meta content="05DB4EB1125C9BB77659AD0ADC8E0BAC" name="msvalidate.01">
    <link href='/assets/fullcalendar.css' rel='stylesheet' />
    <link href='/assets/fullcalendar.print.css' rel='stylesheet' media='print' />
    <script src='/assets/moment.min.js'></script>
    <script src='/assets/jquery.min.js'></script>
    <script src='/assets/fullcalendar.min.js'></script>
    <script>
        $(function() {
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        }

    });
});
    </script>
</head>
<body>  
<%= yield %>

</body>
</html>

但每当我尝试使其成为动态轨道方式时,它都无法正常运行。所以在我的 application.js 文件中

//= require jquery
//= require moment.min
//= require jquery.min
//= require fullcalendar.min
//= require_tree .

在我的 application.css.scss 文件中

 *= require_tree 
 *= require_self

在我的 application.html.erb 文件中

<!DOCTYPE html>
<html>
<head>
  <title>LetsScheduleComMy</title>
  <%= stylesheet_link_tag    'application', media: 'all'%>
  <%= javascript_include_tag 'application'%>
  <%= csrf_meta_tags %>
  <meta charset='utf-8' />
  <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
  <meta name="apple-mobile-web-app-capable" content="yes" /> 
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
  <meta content="05DB4EB1125C9BB77659AD0ADC8E0BAC" name="msvalidate.01">

    <script>
        $(function() {
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        }

    });
});
    </script>
</head>
<body>  
<%= yield %>

</body>
</html>

请注意,这里唯一的区别是我已将所需的 css 和 javascript 文件放入 application.js 和 application.css 文件中,并按照 Rails 的建议在 application.html.erb 文件中添加了 javascript 和 stylesheets 标签。但似乎 fullcalendar 不接受 Rails 的实现方式。

有什么可以做的吗?

Thanks


尝试删除 fullcalendar.print.css ...它解决了我的问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

当应用程序 css 和 javascript 标签在 Rails 上初始化时,fullcalendar 标题工具栏按钮不显示 的相关文章

随机推荐