我正在尝试模仿与gmail相同的行为,其中网址会根据您点击的链接而发生变化,例如https://mail.google.com/mail/u/0/#inbox。
此链接显示如何add a Hash parameter in the URL Rails Routes
然后可以使用jquery to modify the URL hash to add the hash parameter when the view is loaded
从我的测试中,以下路由/route#sent
在服务器中被视为/route
我想念的那部分拼图route to the corresponding route as the hash parameter is not sent to the server?
答案 0 :(得分:0)
部分哈希主要用于浏览器。在加载的页面上,如果哈希值改变了1000次,浏览器就不会向服务器请求一个东西!
使用JS框架(如Angular / Vue)或jQuery来检测哈希变化并相应地加载内容!