需要一些帮助!

我正在尝试让我的骨干路由器匹配此路由:
http://localhost:5150/search_results?utf8=%E2%9C%93&keywords=&location=Norfolk%2C+VA&commit=Search

..而且没有任何效果。很沮丧!
这是我第一次在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

最佳答案

你有尝试过吗?它应该在路由中没有前导冒号,哈希或斜线的情况下工作。

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

关于javascript - Backbone 路由器忽略搜索路由,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15254230/

10-12 07:27