• <i id='xeDcJ'><tr id='xeDcJ'><dt id='xeDcJ'><q id='xeDcJ'><span id='xeDcJ'><b id='xeDcJ'><form id='xeDcJ'><ins id='xeDcJ'></ins><ul id='xeDcJ'></ul><sub id='xeDcJ'></sub></form><legend id='xeDcJ'></legend><bdo id='xeDcJ'><pre id='xeDcJ'><center id='xeDcJ'></center></pre></bdo></b><th id='xeDcJ'></th></span></q></dt></tr></i><div id='xeDcJ'><tfoot id='xeDcJ'></tfoot><dl id='xeDcJ'><fieldset id='xeDcJ'></fieldset></dl></div>
      1. <legend id='xeDcJ'><style id='xeDcJ'><dir id='xeDcJ'><q id='xeDcJ'></q></dir></style></legend><tfoot id='xeDcJ'></tfoot>
          <bdo id='xeDcJ'></bdo><ul id='xeDcJ'></ul>

        <small id='xeDcJ'></small><noframes id='xeDcJ'>

      2. ruby on rails:传单导轨未加载

        时间:2023-08-08

      3. <i id='tGpxO'><tr id='tGpxO'><dt id='tGpxO'><q id='tGpxO'><span id='tGpxO'><b id='tGpxO'><form id='tGpxO'><ins id='tGpxO'></ins><ul id='tGpxO'></ul><sub id='tGpxO'></sub></form><legend id='tGpxO'></legend><bdo id='tGpxO'><pre id='tGpxO'><center id='tGpxO'></center></pre></bdo></b><th id='tGpxO'></th></span></q></dt></tr></i><div id='tGpxO'><tfoot id='tGpxO'></tfoot><dl id='tGpxO'><fieldset id='tGpxO'></fieldset></dl></div>
          <tbody id='tGpxO'></tbody>

          <small id='tGpxO'></small><noframes id='tGpxO'>

            <bdo id='tGpxO'></bdo><ul id='tGpxO'></ul>
            <legend id='tGpxO'><style id='tGpxO'><dir id='tGpxO'><q id='tGpxO'></q></dir></style></legend>
            • <tfoot id='tGpxO'></tfoot>

                  本文介绍了ruby on rails:传单导轨未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  使用 RoR 4.1.4

                  Using RoR 4.1.4

                  我正在尝试使用 leaflet-rails gem.我按照 github 页面中概述的步骤进行操作,但是当我尝试加载地图时,我看到了

                  I am trying to use the leaflet-rails gem. I followed the steps outlined in the github page, but when I try to load the map, I see

                  ReferenceError: L is not defined
                  

                  在浏览器控制台中.这显然意味着 gem 中的帮助程序正在加载和执行,但它找不到 leaflet.js 文件.

                  in the browser console. This obviously means that the helper from the gem is being loaded and executed but it can't find the leaflet.js file.

                  但是,页面的 head 部分显示 /assets/leaflet.js 正在被引用并且它实际上就在那里.

                  However, the head section of the page shows that /assets/leaflet.js is being referenced and it actually IS there.

                  当我查看生成的代码时:

                  When I look at the generated code:

                      <div id="map"></div>
                      <script>
                      var map = L.map('map')
                      map.setView([-54.0, 6.08], 16)
                      L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
                                attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
                                maxZoom: 18,
                      subdomains: '',
                      }).addTo(map)
                      </script>
                    </div>
                    <script src="/assets/jquery.js?body=1" data-turbolinks-track="true"></script>
                    <!-- all the other scripts loaded -->
                    <script src="/assets/exif.js?body=1" data-turbolinks-track="true"></script>
                    <script src="/assets/leaflet.js?body=1" data-turbolinks-track="true"></script>
                    <!-- some more scripts -->
                  

                  因此,gem 在地图 div 的正下方添加了一个脚本,然后,由于 sprockets 机制和所有这些,其他脚本才被加载.对我来说,这看起来很明显脚本不可能加载leaflet.js,因为它被之后引用!

                  So the gem adds a script right below the map div, and only then, due to the sprockets mechanism and all that, the other scripts are loaded. To me this looks like then obviously the script can't possibly load the leaflet.js as it's being referenced afterwards!

                  那么...我是否误解了 RoR 如何处理 gems 和 javascripts?它一定在某个时候起作用了……

                  So...am I misunderstanding something re how RoR handles gems and javascripts? It must have been working at some point...

                  这是我的/app/assets/javascript/application.js:

                  Here's my /app/assets/javascript/application.js:

                  //= require jquery
                  //= require jquery.ui.widget
                  
                  // Here I load a whole bunch of javascripts which are related to jquery-fileupload, cut for brevity
                  //= require bootstrap.min
                  //= require bootbox.min 
                  //= require bootstrap-datepicker
                  
                  //= require exif 
                  //= require leaflet
                  
                  //= require turbolinks
                  //= require_tree .
                  

                  推荐答案

                  不知道你是否能解决你的问题.对我来说,我忘记了跑步:

                  Don't know if you were able to solve your issue. For me, I had forgotten to run:

                  rake assets:precompile
                  

                  在部署到生产之前.

                  这篇关于ruby on rails:传单导轨未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:何时使用 L.TileLayer 与 L.tileLayer 下一篇:传单杂食+聚类标记+过滤标记聚类组

                  相关文章

                  最新文章

                    <small id='3fv2h'></small><noframes id='3fv2h'>

                      <i id='3fv2h'><tr id='3fv2h'><dt id='3fv2h'><q id='3fv2h'><span id='3fv2h'><b id='3fv2h'><form id='3fv2h'><ins id='3fv2h'></ins><ul id='3fv2h'></ul><sub id='3fv2h'></sub></form><legend id='3fv2h'></legend><bdo id='3fv2h'><pre id='3fv2h'><center id='3fv2h'></center></pre></bdo></b><th id='3fv2h'></th></span></q></dt></tr></i><div id='3fv2h'><tfoot id='3fv2h'></tfoot><dl id='3fv2h'><fieldset id='3fv2h'></fieldset></dl></div>
                    1. <tfoot id='3fv2h'></tfoot>
                      <legend id='3fv2h'><style id='3fv2h'><dir id='3fv2h'><q id='3fv2h'></q></dir></style></legend>
                      • <bdo id='3fv2h'></bdo><ul id='3fv2h'></ul>