简体   繁体   English

骨干路由器忽略搜索路由

[英]Backbone Router Ignoring search route

In need of some help! 需要一些帮助!

I'm trying to get my Backbone router to match this route: http://localhost:5150/search_results?utf8=%E2%9C%93&keywords=&location=Norfolk%2C+VA&commit=Search 我正在尝试让我的骨干路由器匹配此路由: http://localhost:5150/search_results?utf8=%E2%9C%93&keywords=&location=Norfolk%2C+VA&commit=Search

..And nothing is working. ..并且没有任何效果。 Very frustrating! 很沮丧!
This is my first try at Backbone, so advice would be awesome. 这是我第一次在Backbone尝试,所以建议会很棒。

 '/search_results?*': 'search_results'
  # NOPE

 '/search_results?foo=:foo': 'search_results'
  # NOPE

 '/search_results?foo*': 'search_results'
  # NOPE

 '/search_results?*queryString': 'search_results'
  # NOPE

 'search_results?*queryString': 'search_results'
  # NOPE

 'search_results?*': 'search_results'
 # NOPE

 'search_results?foo=:foo': 'search_results'
 # NOPE

 'search_results?foo*': 'search_results'
 # NOPE

'/search_results': 'search_results'
 # NOPE SERIOUSLY??

 '/search_results': 'search_results'
 # WTF!!!!!!!!!!!!!!!!!!!

 ':search_results?*': 'search_results'
 # NOPE

 ':search_results?:querystring': 'search_results'
 # NOPE

Have you tried this? 你有尝试过吗? It should work without a leading colon, hash or slash in the route. 它应该在路由中没有前导冒号,哈希或斜线的情况下工作。

'search_results(?:queryString)': 'search_results'

Okey... Backbone routes generally detect route path by # keyword as far as I know..correct me if I'm wrong. Okey ...据我所知,骨干路由通常通过#关键字检测路由路径。如果我错了,请纠正我。 So to make the things work in your case do the following things. 因此,为了使事情适合您的情况,请执行以下操作。

1) Put the # keyword like #/search_results?.... 1)输入#关键字,例如#/ search_results?....

2) Now define your route as "search_results?:queryString" 2)现在将您的路线定义为“ search_results?:queryString”

This should work :) 这应该工作:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM