如何在Iron-router中获取查询参数?

如何在Iron-router中获取查询参数?

问题描述:

我正在尝试在网址中获取查询参数.

I am trying to get the query parameters in the url.

似乎没有一种简便的方法...

There doesn't seem to be an easy way to do this...

这让我感到我一定错过了文档中的某些内容.

which leaves me with the feeling that I must have missed a something in the doc.

铁路由器> = 1.0

路线的查询参数可作为this.params.query的属性.

如果您的网址如下:

/posts/5?sort_by=created_at

然后this.params.query.sort_by等于'created_at'.

铁router刨机< 1.0

路径的查询参数可用作this.params的属性.

A route's query parameters are available as properties of this.params.

如果您的网址如下:

/posts/5?sort_by=created_at

然后this.params.sort_by等于'created_at'.