如何将参数传递到Backbone中的另一个页面?

我使用Backbonenavigate来group_edit.html,我想将id传递给group_edit.html。

例如

var routes = {};
routes[AD.page + '/edit/:_id']   = 'act_edit_group';

act_edit_group: function(id) {
    var t = this;

    t.navigate("#ajax/group_edit.html", {
        trigger: true
    });
}


但是我在group_edit.html中无法获得ID。

谢谢。

最佳答案

这条路。

routes: {
    "test/:id":"home"
  },

  home: function(id) {
      console.log(id);
      // "1"
  }


如果您传递此网址(localhost ....#test / 1),则会触发此路由

希望能帮助到你

关于javascript - 如何将参数传递到Backbone中的另一个页面?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24955164/

10-09 18:09
查看更多