使用 Iron Router 更新查询参数

Update Query Param with Iron Router

我正在尝试找出在 Iron Router 中更新查询参数的最不脆弱的方法。
Flow-Router 有 FlowRouter.setParams({step: 2}) 是理想的。

目前我正在使用这个,但我想检查是否有更好的方法(特别是因为 IR API 变化如此频繁)

var currentId = Router.current().params.id;
var newStep = '2';
Router.go('checkout', {id: currentId}, {query: 'step=' + newStep});

这是正确的方法,但您可以像在 FlowRouter.

中一样使用对象语法进行查询
Router.go('checkout', {
  id: currentId
}, {
  query: {
    step: 2
  }
});