下拉仅触发一次 [英] dropdowns only trigger once

查看:162
本文介绍了下拉仅触发一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此网站上有两个过滤器下拉菜单,这只会在我第一次按时触发他们。根据我的研究,它似乎与涡轮链接有关,我通过向body标签添加data-no-turbolink来禁用turbolink,如下所示:

I have two filter dropdowns on this site which will only trigger the first time I press them. According to my studies it seems that it has to do with turbolinks, which I've disabled by adding data-no-turbolink to the body tag like so:

<body data-no-turbolink>
...
</body>

我也试着将其添加到所有下拉链接和打开下拉列表的链接中。

I've also tried adding this to all of the dropdown links and the link to open the dropdown.

<a href="some-link" data-no-turbolink>...</a>

它似乎适用于开发,但是当我推到Heroku时,似乎turbolinks再次运行。任何建议?

It seems to work on development, but when I push to Heroku, it seems turbolinks are running again. Any suggestions?

推荐答案

如果Turbolinks存在问题,可以按照提供的说明从项目中完全删除。 此处

If Turbolinks is an issue, it can be removed entirely from the project by following the instructions provided e.g. here:


  1. 从Gemfile中删除 gem'turbolinks'并运行 code

  2. app / assets / javascripts / application.js中移除 // = require turbolinks strong>

  3. 删除data-turbolinks-track=> application.html标头中的样式表 javascript 标签的真标签.erb 布局文件。

  1. remove gem 'turbolinks' from the Gemfile and run bundle update
  2. remove //= require turbolinks from app/assets/javascripts/application.js
  3. remove "data-turbolinks-track" => true from the stylesheet and javascript tags in the header of application.html.erb layout file.

引用 Rails 4 In Action


...我们认为Turoblinks非常适合加速
主要服务器端网站,但只要您开始编写一些
JavaScript,它会导致更多的问题,而不是它的价值。

...it's our opinion that Turoblinks is great to speed up mostly-server-side sites, but as soon as you start writing some JavaScript, it causes more problems than it's worth.

这篇关于下拉仅触发一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆