1

需要一些帮助!

我正在尝试让我的主干路由器匹配此路由: 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
4

2 回答 2

1

Have you tried this? It should work without a leading colon, hash or slash in the route.

'search_results(?:queryString)': 'search_results'
于 2013-03-07T13:20:25.013 回答
0

Okey... Backbone routes generally detect route path by # keyword as far as I know..correct me if I'm wrong. So to make the things work in your case do the following things.

1) Put the # keyword like #/search_results?....

2) Now define your route as "search_results?:queryString"

This should work :)

于 2013-03-06T18:53:28.160 回答