From 4890eda31b9bc60ea4a1a7f36460ec1bf86dc134 Mon Sep 17 00:00:00 2001 From: Ruanyq Date: Mon, 12 Jun 2017 18:16:35 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20Uniform=20the=20standards=20that=20we?= =?UTF-8?q?=20should=20acquire=20this=20parsed=20parame=E2=80=A6=20(#1038)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/source/en/basics/router.md | 10 +++++----- docs/source/zh-cn/basics/router.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/source/en/basics/router.md b/docs/source/en/basics/router.md index f526c02a33..b6c5f95672 100644 --- a/docs/source/en/basics/router.md +++ b/docs/source/en/basics/router.md @@ -133,7 +133,7 @@ module.exports = app => { // app/controller/search.js module.exports = function* (ctx) { - ctx.body = `search: ${this.query.name}`; + ctx.body = `search: ${ctx.query.name}`; }; // curl http://127.0.0.1:7001/search?name=egg @@ -265,9 +265,9 @@ module.exports = app => { }; // app/controller/search.js -module.exports = function* () { - const type = this.query.type; - const q = this.query.q || 'nodejs'; +module.exports = function* (ctx) { + const type = ctx.query.type; + const q = ctx.query.q || 'nodejs'; if (type === 'bing') { this.redirect(`http://cn.bing.com/search?q=${q}`); @@ -288,7 +288,7 @@ Here we just briefly explain how to use the middleware, and refer to [Middleware ```js // app/controller/search.js module.exports = function* (ctx) { - ctx.body = `search: ${this.query.name}`; + ctx.body = `search: ${ctx.query.name}`; }; // app/middleware/uppercase.js diff --git a/docs/source/zh-cn/basics/router.md b/docs/source/zh-cn/basics/router.md index 6c71f84de4..06760c6ddc 100644 --- a/docs/source/zh-cn/basics/router.md +++ b/docs/source/zh-cn/basics/router.md @@ -138,7 +138,7 @@ module.exports = app => { // app/controller/search.js module.exports = function* (ctx) { - ctx.body = `search: ${this.query.name}`; + ctx.body = `search: ${ctx.query.name}`; }; // curl http://127.0.0.1:7001/search?name=egg @@ -270,9 +270,9 @@ module.exports = app => { }; // app/controller/search.js -module.exports = function* () { - const type = this.query.type; - const q = this.query.q || 'nodejs'; +module.exports = function* (ctx) { + const type = ctx.query.type; + const q = ctx.query.q || 'nodejs'; if (type === 'bing') { this.redirect(`http://cn.bing.com/search?q=${q}`); @@ -293,7 +293,7 @@ module.exports = function* () { ```js // app/controller/search.js module.exports = function* (ctx) { - ctx.body = `search: ${this.query.name}`; + ctx.body = `search: ${ctx.query.name}`; }; // app/middleware/uppercase.js