使用backbone.js更改URL

问题描述 投票:-1回答:2

我查看我的主干模块

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

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

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

注意:

我的骨干视图是使用Backbone.history.navigate(another_module, {trigger:true});,但它给了我一个像这样的URL

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

javascript backbone.js
2个回答
1
投票

你为什么不这样试试呢?

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

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


-1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.