[英]Turbolinks page:fetch not working in Rails
I'm working on an enterprise application which made with Ruby on Rails actually I'm working for the maintenance on the web app, so I want to add a spinner on this application instead of Turbolinks ProgressBar , so on the initial stage I'm testing the page:change
& page:receive
working but those is not working, look how I tested 我正在使用Ruby on Rails制作的企业应用程序,实际上是在维护Web应用程序,因此我想在此应用程序上添加一个微调器 ,而不是Turbolinks ProgressBar ,所以在初始阶段,我是测试page:change
和page:receive
正常,但无法正常工作,请看我如何测试
$(document).on('page:fetch', function() {
alert("OK");
});
$(document).on("page:receive", function(){
alert("OK");
});
also 也
$(document).on('turbolinks:fetch', function() {
alert("OK");
});
$(document).on("turbolinks:receive", function(){
alert("OK");
});
also, browser console is clean no any error. 此外,浏览器控制台干净无任何错误。
Thanks 谢谢
You can see the latest Turbolinks
Full List of Events
then it should be like this use turbolinks:request-start
instead turbolinks:fetch
and page:fetch
, request-start
for receive
您可以看到最新的Turbolinks
Full List of Events
然后应该使用turbolinks:request-start
代替turbolinks:fetch
和page:fetch
, request-start
receive
request-start
$(function() {
document.addEventListener('turbolinks:request-start', function() {
alert("OK");
});
document.addEventListener("turbolinks:request-end", function(){
alert("OK");
});
});
I have used this for mine and it's working. 我已经将它用于我的并且正在工作。
Hope it will help you. 希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.