使用backbone.js更改URL

时间:2017-12-19 09:06:41

标签: javascript backbone.js

我用

查看我的主干模块
  

http://localhost/src/index.html#test_module

URL。 但我需要查看另一个模块,如

  

http://localhost/src/index.html#test_module/another_module

注:

我的骨干视图正在使用Backbone.history.navigate(another_module, {trigger:true});,但它为我提供了一个类似

的网址
  

http://localhost/src/index.html#another_module

2 个答案:

答案 0 :(得分:1)

为什么不尝试这样做。

Backbone.history.navigate("test_module/another_module", { trigger: true });

阅读documentation on navigate了解更多信息。

答案 1 :(得分:-1)

在使用骨干开发时,您应该使用Backbone Routers作为最佳选择。您可以阅读文档以便更好地理解。