From 10d09efb51bbee8afff66d43f33731efcc8b1a18 Mon Sep 17 00:00:00 2001 From: yinyong Date: Mon, 8 Dec 2014 12:13:35 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=EF=BC=8C=E4=BF=AE=E6=AD=A3=E4=B8=8D=E9=80=9A?= =?UTF-8?q?=E9=A1=BA=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/bilingual_guides/object-model/observers.md | 4 ++-- source/guides/object-model/observers.md | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/bilingual_guides/object-model/observers.md b/source/bilingual_guides/object-model/observers.md index 3566597..e461839 100644 --- a/source/bilingual_guides/object-model/observers.md +++ b/source/bilingual_guides/object-model/observers.md @@ -103,13 +103,13 @@ person.set('lastName', 'Smith'); Observers never fire until after the initialization of an object is complete. -观察器只有直到对象完成了初始化过程才会被触发。 +观察器只有对象完成了初始化过程之后才会被触发。 If you need an observer to fire as part of the initialization process, you cannot rely on the side effect of set. Instead, specify that the observer should also run after init by using `.on('init')`: -如果需要在初始化过程中就触发一个观察器,那么不能依赖于`set`的负效应。而应该在观察器上,通过使用`.on('init')`指定观察器应该在初始化后执行: +如果需要在初始化过程中就触发一个观察器,那么不能依赖于`set`的负效应。而应该在观察器上,通过使用`.on('init')`指定观察器应该在初始化后执行: ```javascript App.Person = Ember.Object.extend({ diff --git a/source/guides/object-model/observers.md b/source/guides/object-model/observers.md index 23e2a83..22f74da 100644 --- a/source/guides/object-model/observers.md +++ b/source/guides/object-model/observers.md @@ -37,9 +37,8 @@ Ember中的观察器目前都是同步的。这就意味着一旦其观察的属 ```javascript Person.reopen({ lastNameChanged: function() { - // The observer depends on lastName and so does fullName. Because observers - // are synchronous, when this function is called the value of fullName is - // not updated yet so this will log the old value of fullName + // 该观察器和 fullName 都依赖于 lastName。因为观察器都是异步的,当该函数被调用时, + // fullName 还没有被更新,因此这里会打印出 fullName 的旧值。 console.log(this.get('fullName')); }.observes('lastName') }); @@ -78,9 +77,9 @@ person.set('lastName', 'Smith'); ### 观察器与对象初始化 -观察器只有直到对象完成了初始化过程才会被触发。 +观察器只有对象完成了初始化过程之后才会被触发。 -如果需要在初始化过程中就触发一个观察器,那么不能依赖于`set`的负效应。而应该在观察器上,通过使用`.on('init')`指定观察器应该在初始化后执行: +如果需要在初始化过程中就触发一个观察器,那么不能依赖于`set`的负效应。而应该在观察器上,通过使用`.on('init')`指定观察器应该在初始化后执行: ```javascript App.Person = Ember.Object.extend({ From 22320f0ad4cb3aab4a2b3644a20fb943486c243f Mon Sep 17 00:00:00 2001 From: yinyong Date: Mon, 8 Dec 2014 18:07:18 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/guides/views/handling-events.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/guides/views/handling-events.md b/source/guides/views/handling-events.md index 3608539..d88bc6e 100644 --- a/source/guides/views/handling-events.md +++ b/source/guides/views/handling-events.md @@ -53,7 +53,7 @@ App.PlaybackController = Ember.ObjectController.extend({ App.PlaybackRoute = Ember.Route.extend({ actions: { turnItUp: function(level){ - //This won't be called if it's defined on App.PlaybackController + //如果定义在 App.PlaybackController 了那么这里就不会被调用 } } }); From 9216e19e5444ec5d10a7397f61d195ac31bcddc4 Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 15:58:45 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/guides/views/manually-managing-view-hierarchy.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/guides/views/manually-managing-view-hierarchy.md b/source/guides/views/manually-managing-view-hierarchy.md index c36a5a0..03bc636 100644 --- a/source/guides/views/manually-managing-view-hierarchy.md +++ b/source/guides/views/manually-managing-view-hierarchy.md @@ -14,10 +14,8 @@ var firstView = App.FirstView.create(), container.pushObject(firstView); container.pushObject(secondView); -// When the rendering completes, the DOM -// will contain a `div` for the ContainerView -// and nested inside of it, a `div` for each of -// firstView and secondView. +// 当渲染完成时,DOM 会在 ContainerView 的 `div` 内 +// 嵌入 firstView 和 secondView 两个 `div`。 ``` ### 定义容器视图的初始视图 From e5b9fd65cb58fd67dd3070f13df465f19fcde765 Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 16:02:06 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../disabling-prototype-extensions.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source/guides/configuring-ember/disabling-prototype-extensions.md b/source/guides/configuring-ember/disabling-prototype-extensions.md index d4ed608..ada3193 100644 --- a/source/guides/configuring-ember/disabling-prototype-extensions.md +++ b/source/guides/configuring-ember/disabling-prototype-extensions.md @@ -44,12 +44,9 @@ ENV.EXTEND_PROTOTYPES = false; ```javascript var islands = ['Oahu', 'Kauai']; islands.contains('Oahu'); -//=> TypeError: Object Oahu,Kauai has no method 'contains' //=> 类型错误: Oahu,Kauai 对象没有 'contains' 方法 -// Convert `islands` to an array that implements the -// Ember enumerable and array interfaces -//将`islands`转换为实现了Ember枚举以及数组接口的数组 +// 将`islands`转换为实现了Ember枚举以及数组接口的数组 Ember.A(islands); islands.contains('Oahu'); @@ -64,7 +61,6 @@ islands.contains('Oahu'); ```javascript "my_cool_class".camelize(); -//=> TypeError: Object my_cool_class has no method 'camelize' //=> 类型错误: my_cool_class 对象没有`camelize`方法 Ember.String.camelize("my_cool_class"); @@ -79,14 +75,12 @@ Ember.String.camelize("my_cool_class"); 用`Ember.computed()`方法来包裹函数以标记计算属性。 ```javascript -// This won't work: //这样的代码不会起作用: fullName: function() { return this.get('firstName') + ' ' + this.get('lastName'); }.property('firstName', 'lastName') -// Instead, do this: //你需要这样做: fullName: Ember.computed('firstName', 'lastName', function() { return this.get('firstName') + ' ' + this.get('lastName'); @@ -96,14 +90,12 @@ fullName: Ember.computed('firstName', 'lastName', function() { 用`Ember.observer()`来标记观察者: ```javascript -// This won't work: //这样的代码不会起作用: fullNameDidChange: function() { console.log("Full name changed"); }.observes('fullName') -// Instead, do this: //你需要这样做: fullNameDidChange: Ember.observer('fullName', function() { console.log("Full name changed"); From 2f8ac2f2143ee8c0a07ce7e2c633968c3ae8314b Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 16:50:40 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E2=80=9C=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E5=8E=9F=E6=96=87=E2=80=9D=E9=83=A8=E5=88=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=98=BE=E7=A4=BA=E4=B8=8B=E5=88=92=E7=BA=BF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binding_properties_of_an_object_to_its_own_properties.md | 2 +- source/guides/cookbook/event_handling_and_data_binding/index.md | 2 +- .../helpers_and_components/adding_google_analytics_tracking.md | 2 +- .../creating_reusable_social_share_buttons.md | 2 +- source/guides/cookbook/helpers_and_components/index.md | 2 +- .../adding_css_classes_to_your_components.md | 2 +- ...adding_css_classes_to_your_components_based_on_properties.md | 2 +- .../displaying_formatted_dates_with_moment_js.md | 2 +- .../focusing_a_textfield_after_its_been_inserted.md | 2 +- source/guides/cookbook/user_interface_and_interaction/index.md | 2 +- .../resetting_scroll_on_route_changes.md | 2 +- ...data_driven_areas_of_templates_that_do_not_need_to_update.md | 2 +- .../user_interface_and_interaction/using_modal_dialogs.md | 2 +- .../working_with_objects/continuous_redrawing_of_views.md | 2 +- .../incrementing_or_decrementing_a_property.md | 2 +- source/guides/cookbook/working_with_objects/index.md | 2 +- .../working_with_objects/setting_multiple_properties_at_once.md | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties.md b/source/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties.md index a136e01..7eb2ab3 100644 --- a/source/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties.md +++ b/source/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties) +英文原文:[http://emberjs.com/guides/cookbook/event\_handling\_and\_data\_binding/binding\_properties\_of\_an\_object\_to\_its\_own\_properties](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties) ### 问题 diff --git a/source/guides/cookbook/event_handling_and_data_binding/index.md b/source/guides/cookbook/event_handling_and_data_binding/index.md index 9db2859..ea2fe5e 100644 --- a/source/guides/cookbook/event_handling_and_data_binding/index.md +++ b/source/guides/cookbook/event_handling_and_data_binding/index.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/event_handling_and_data_binding/](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/) +英文原文:[http://emberjs.com/guides/cookbook/event\_handling\_and\_data\_binding/](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/) 下面是一些管理事件和处理绑定的技巧: diff --git a/source/guides/cookbook/helpers_and_components/adding_google_analytics_tracking.md b/source/guides/cookbook/helpers_and_components/adding_google_analytics_tracking.md index 70284af..500c866 100644 --- a/source/guides/cookbook/helpers_and_components/adding_google_analytics_tracking.md +++ b/source/guides/cookbook/helpers_and_components/adding_google_analytics_tracking.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/helpers_and_components/adding_google_analytics_tracking](http://emberjs.com/guides/cookbook/helpers_and_components/adding_google_analytics_tracking) +英文原文:[http://emberjs.com/guides/cookbook/helpers\_and\_components/adding\_google\_analytics\_tracking](http://emberjs.com/guides/cookbook/helpers_and_components/adding_google_analytics_tracking) ### 问题 diff --git a/source/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons.md b/source/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons.md index 5dc38c6..b4bb792 100644 --- a/source/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons.md +++ b/source/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons](http://emberjs.com/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons) +英文原文:[http://emberjs.com/guides/cookbook/helpers\_and\_components/creating\_reusable\_social\_share\_buttons](http://emberjs.com/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons) ### 问题 diff --git a/source/guides/cookbook/helpers_and_components/index.md b/source/guides/cookbook/helpers_and_components/index.md index afb4441..40c2938 100644 --- a/source/guides/cookbook/helpers_and_components/index.md +++ b/source/guides/cookbook/helpers_and_components/index.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/helpers_and_components/](http://emberjs.com/guides/cookbook/helpers_and_components/) +英文原文:[http://emberjs.com/guides/cookbook/helpers\_and\_components/](http://emberjs.com/guides/cookbook/helpers_and_components/) 下面是一些可以用于封装代码到组件和构建助手的技巧: diff --git a/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components.md b/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components.md index 954f141..aca041b 100644 --- a/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components.md +++ b/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/adding\_css\_classes\_to\_your\_components](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components) ### 问题 diff --git a/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties.md b/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties.md index 391e438..54e8033 100644 --- a/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties.md +++ b/source/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/adding\_css\_classes\_to\_your\_components\_based\_on\_properties](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties) ### 问题 diff --git a/source/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js.md b/source/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js.md index 2b28699..7c684b4 100644 --- a/source/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js.md +++ b/source/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js](http://emberjs.com/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/displaying\_formatted\_dates\_with\_moment\_js](http://emberjs.com/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js) ### 问题 diff --git a/source/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted.md b/source/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted.md index 2859c8b..fbca529 100644 --- a/source/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted.md +++ b/source/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted](http://emberjs.com/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/focusing\_a\_textfield\_after\_its\_been\_inserted](http://emberjs.com/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted) ### 问题 diff --git a/source/guides/cookbook/user_interface_and_interaction/index.md b/source/guides/cookbook/user_interface_and_interaction/index.md index 9a70d91..678a1e3 100644 --- a/source/guides/cookbook/user_interface_and_interaction/index.md +++ b/source/guides/cookbook/user_interface_and_interaction/index.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/](http://emberjs.com/guides/cookbook/user_interface_and_interaction/) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/](http://emberjs.com/guides/cookbook/user_interface_and_interaction/) 下面是一些可以帮助提供更好用户体验的技巧: diff --git a/source/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes.md b/source/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes.md index 0d5e1b7..2fd4b14 100644 --- a/source/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes.md +++ b/source/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes](http://emberjs.com/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/resetting\_scroll\_on\_route\_changes](http://emberjs.com/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes) ### 问题 diff --git a/source/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update.md b/source/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update.md index ce6e279..c63d315 100644 --- a/source/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update.md +++ b/source/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update](http://emberjs.com/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/specifying\_data\_driven\_areas\_of\_templates\_that\_do\_not\_need\_to\_update](http://emberjs.com/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update) ### 问题 diff --git a/source/guides/cookbook/user_interface_and_interaction/using_modal_dialogs.md b/source/guides/cookbook/user_interface_and_interaction/using_modal_dialogs.md index a48d25e..2a4ce3a 100644 --- a/source/guides/cookbook/user_interface_and_interaction/using_modal_dialogs.md +++ b/source/guides/cookbook/user_interface_and_interaction/using_modal_dialogs.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs](http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs) +英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/using\_modal\_dialogs](http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs) ### 问题 diff --git a/source/guides/cookbook/working_with_objects/continuous_redrawing_of_views.md b/source/guides/cookbook/working_with_objects/continuous_redrawing_of_views.md index 45319d1..12af715 100644 --- a/source/guides/cookbook/working_with_objects/continuous_redrawing_of_views.md +++ b/source/guides/cookbook/working_with_objects/continuous_redrawing_of_views.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/continuous_redrawing_of_views](http://emberjs.com/guides/cookbook/working_with_objects/continuous_redrawing_of_views) +英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/continuous\_redrawing\_of\_views](http://emberjs.com/guides/cookbook/working_with_objects/continuous_redrawing_of_views) ## 问题 diff --git a/source/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property.md b/source/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property.md index 538ede1..65b2c08 100644 --- a/source/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property.md +++ b/source/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property](http://emberjs.com/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property) +英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/incrementing\_or\_decrementing\_a\_property](http://emberjs.com/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property) ### 问题 diff --git a/source/guides/cookbook/working_with_objects/index.md b/source/guides/cookbook/working_with_objects/index.md index fbc9c5b..cc5bd3c 100644 --- a/source/guides/cookbook/working_with_objects/index.md +++ b/source/guides/cookbook/working_with_objects/index.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/](http://emberjs.com/guides/cookbook/working_with_objects/) +英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/](http://emberjs.com/guides/cookbook/working_with_objects/) 下面是一些可以帮助理解如何使用Ember对象的技巧: diff --git a/source/guides/cookbook/working_with_objects/setting_multiple_properties_at_once.md b/source/guides/cookbook/working_with_objects/setting_multiple_properties_at_once.md index b04e74e..71928fd 100644 --- a/source/guides/cookbook/working_with_objects/setting_multiple_properties_at_once.md +++ b/source/guides/cookbook/working_with_objects/setting_multiple_properties_at_once.md @@ -1,4 +1,4 @@ -英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/setting_multiple_properties_at_once](http://emberjs.com/guides/cookbook/working_with_objects/setting_multiple_properties_at_once) +英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/setting\_multiple\_properties\_at\_once](http://emberjs.com/guides/cookbook/working_with_objects/setting_multiple_properties_at_once) ### 问题 From 4d0241a061c2f2f551c9e26c2985cd108d8e74db Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 16:57:14 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E7=B4=A2=E5=BC=95=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/guides.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/guides.yml b/data/guides.yml index 011083a..692f1d0 100644 --- a/data/guides.yml +++ b/data/guides.yml @@ -307,7 +307,7 @@ Cookbook: - title: "使用模态对话框" url: "cookbook/user_interface_and_interaction/using_modal_dialogs" skip_sidebar_item: true - - title: "Resetting scroll on route changes" + - title: "路由改变时重置滚动条" url: "cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes" skip_sidebar_item: true # - title: "Converting Strings to Currency With Accounting.js" @@ -373,7 +373,7 @@ Cookbook: - title: "一次设置多个属性值" url: "cookbook/working_with_objects/setting_multiple_properties_at_once" skip_sidebar_item: true - - title: "Continuous Redrawing of Views" + - title: "持续重绘视图" url: "cookbook/working_with_objects/continuous_redrawing_of_views" skip_sidebar_item: true # - title: "Continuous Redrawing of Views" From ef87b2b10c72ecaf8cfa0c599fb2a5468db97a69 Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 17:06:48 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A0=87=E7=82=B9?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/bilingual_guides/routing/index.md | 4 ++-- source/guides/routing/index.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/bilingual_guides/routing/index.md b/source/bilingual_guides/routing/index.md index 8517901..45fc21c 100644 --- a/source/bilingual_guides/routing/index.md +++ b/source/bilingual_guides/routing/index.md @@ -58,13 +58,13 @@ or more of the following: 3. Change the template on screen, or place a new template into an existing outlet. - 更改屏幕(浏览器窗口)上的模板,或者在已存在的出口(outlet)上替换新的模板 + 更改屏幕(浏览器窗口)上的模板,或者在已存在的出口(outlet)上替换新的模板 ###(记录追踪路由的变化)Logging Route Changes As your application increases in complexity, it can be helpful to see exactly what is going on with the router. To have Ember write out transition events to the log, simply modify your `Ember.Application`: -当你的应用变得越来越复杂,明白路由究竟发生了什么是很有帮助的。只要简单的修改一下你的Ember.Application,就可以让ember记录路由的事件转换。 +当你的应用变得越来越复杂,明白路由究竟发生了什么是很有帮助的。只要简单的修改一下你的 `Ember.Application`,就可以让ember记录路由的事件转换: ```javascript App = Ember.Application.create({ diff --git a/source/guides/routing/index.md b/source/guides/routing/index.md index bf244a1..f2ece18 100644 --- a/source/guides/routing/index.md +++ b/source/guides/routing/index.md @@ -24,11 +24,11 @@ handlers)中, 我们可以简单而清晰地回答上面所问的问题:_登 2. 更新控制器(controller)以便映射到特定的模型(model)上 -3. 更改屏幕(浏览器窗口)上的模板,或者在已存在的出口(outlet)上替换新的模板 +3. 更改屏幕(浏览器窗口)上的模板,或者在已存在的出口(outlet)上替换新的模板 ### 记录追踪路由的变化 -当你的应用变得越来越复杂,明白路由究竟发生了什么是很有帮助的。只要简单的修改一下你的Ember.Application,就可以让ember记录路由的事件转换。 +当你的应用变得越来越复杂,明白路由究竟发生了什么是很有帮助的。只要简单的修改一下你的 `Ember.Application`,就可以让ember记录路由的事件转换: ```javascript App = Ember.Application.create({ From 5f9792c1a9b25c1a8665d32d3c4b79fc2713ea56 Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 17:24:30 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AF=AD=E6=84=8F?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=B8=8E=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routing/defining-your-routes.md | 22 ++++++++----------- source/guides/routing/defining-your-routes.md | 22 ++++++++----------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/source/bilingual_guides/routing/defining-your-routes.md b/source/bilingual_guides/routing/defining-your-routes.md index 5537045..ff30638 100644 --- a/source/bilingual_guides/routing/defining-your-routes.md +++ b/source/bilingual_guides/routing/defining-your-routes.md @@ -20,14 +20,14 @@ App.Router.map(function() { Now, when the user visits `/about`, Ember.js will render the `about` template. Visiting `/favs` will render the `favorites` template. -现在当用户访问'/about'时,Ember.js就会渲染`about`的模板。访问'/favs'将渲染`favorites`的模板。 +现在当用户访问`/about`时,Ember.js就会渲染`about`的模板。访问`/favs`将渲染`favorites`的模板。 Note that you can leave off the path if it is the same as the route @@ -47,8 +47,8 @@ Inside your templates, you can use `{{link-to}}` to navigate between routes, using the name that you provided to the `route` method (or, in the case of `/`, the name `index`). -在模板里面,你可以用{{link-to}}来导向路由,这需要用到你在route方法中定义的名字 -(对于'/'来说,名字就是index)。 +在模板里面,你可以用`{{link-to}}`来导向路由,这需要用到你在`route`方法中定义的名字 +(对于`/`来说,名字就是`index`)。 ```handlebars {{#link-to 'index'}}{{/link-to}} @@ -62,14 +62,14 @@ the case of `/`, the name `index`). The `{{link-to}}` helper will also add an `active` class to the link that points to the currently active route. -{{link-to}}助手会在链接上面加上active的类名(class)来指出当前活跃的路由。 +`{{link-to}}`助手会在链接上面加上`active`的类名(class)来指出当前活跃的路由。 You can customize the behavior of a route by creating an `Ember.Route` subclass. For example, to customize what happens when your user visits `/`, create an `App.IndexRoute`: 你也可以通过创建一个`Ember.Route`的子类来对路由的行为进行自定义。例如,创建 -`App.IndexRoute`类来定义当用户访问'/'时会发生什么。 +`App.IndexRoute`类来定义当用户访问`/`时会发生什么。 ```javascript App.IndexRoute = Ember.Route.extend({ @@ -208,8 +208,7 @@ This router creates three routes: `posts` is equivalent to transitioning to `posts.index` or linking to `posts.index` -1 跳转到`posts`或者链接到`posts`,等效于跳转 -到`posts.index`或链接到`posts.index`。 +1 跳转到`posts`或者链接到`posts`,等效于跳转到`posts.index`或链接到`posts.index`。 NOTE: If you define a resource using `this.resource` and **do not** supply a function, then the implicit `resource.index` route is **not** created. In @@ -264,8 +263,7 @@ into a model. For example, if we have the resource `this.resource('posts')`, our route handler might look like this: -例如,如果我们有一个资源`this.resource('posts')`,那么我们的路由处理器看起来 -可能像这样: +例如,如果我们有一个资源`this.resource('posts')`,那么我们的路由处理器看起来可能像这样: ```js App.PostsRoute = Ember.Route.extend({ @@ -285,9 +283,7 @@ additional information to know what to use. However, if we want a route to represent a single post, we would not want to have to hardcode every possible post into the router. -由于`/posts`映射到一个特定的模型上,所以我们不需要其他额外的信息就可以 -运行。然而,如果我们想要路由映射到某个post上,我们可不想通过在路由器中 -写死每一个可能的post来实现。 +由于`/posts`映射到一个特定的模型上,所以我们不需要其他额外的信息就可以运行。然而,如果我们想要路由映射到某个post上,我们可不想通过在路由器中写死每一个可能的post来实现。 Enter _dynamic segments_. diff --git a/source/guides/routing/defining-your-routes.md b/source/guides/routing/defining-your-routes.md index 6fdd9dc..d053321 100644 --- a/source/guides/routing/defining-your-routes.md +++ b/source/guides/routing/defining-your-routes.md @@ -10,10 +10,10 @@ App.Router.map(function() { }); ``` -现在当用户访问'/about'时,Ember.js就会渲染`about`的模板。访问'/favs'将渲染`favorites`的模板。 +现在当用户访问`/about`时,Ember.js就会渲染`about`的模板。访问`/favs`将渲染`favorites`的模板。 提示:如果路径(path)的名字跟路由(route)的名字是一样的话,你可以不用写上路径。 @@ -26,8 +26,8 @@ App.Router.map(function() { }); ``` -在模板里面,你可以用{{link-to}}来导向路由,这需要用到你在route方法中定义的名字 -(对于'/'来说,名字就是index)。 +在模板里面,你可以用`{{link-to}}`来导向路由,这需要用到你在`route`方法中定义的名字 +(对于`/`来说,名字就是`index`)。 ```handlebars {{#link-to 'index'}}{{/link-to}} @@ -38,10 +38,10 @@ App.Router.map(function() { ``` -{{link-to}}助手会在链接上面加上active的类名(class)来指出当前活跃的路由。 +`{{link-to}}`助手会在链接上面加上`active`的类名(class)来指出当前活跃的路由。 你也可以通过创建一个`Ember.Route`的子类来对路由的行为进行自定义。例如,创建 -`App.IndexRoute`类来定义当用户访问'/'时会发生什么。 +`App.IndexRoute`类来定义当用户访问`/`时会发生什么。 ```javascript App.IndexRoute = Ember.Route.extend({ @@ -161,8 +161,7 @@ App.Router.map(function() { -1 跳转到`posts`或者链接到`posts`,等效于跳转 -到`posts.index`或链接到`posts.index`。 +1 跳转到`posts`或者链接到`posts`,等效于跳转到`posts.index`或链接到`posts.index`。 注意:如果你通过`this.resource`定义了一个资源,但是*没有*提供一个函数作为参数, 那么隐式的`resource.index`是*不会*被创建的。在这种情况下,`/resource`只会用到 @@ -184,8 +183,7 @@ App.Router.map(function() { 在路由处理器的众多职责里,其中有一个就是转换URL并将其传入模型(`model`)中。 -例如,如果我们有一个资源`this.resource('posts')`,那么我们的路由处理器看起来 -可能像这样: +例如,如果我们有一个资源`this.resource('posts')`,那么我们的路由处理器看起来可能像这样: ```js App.PostsRoute = Ember.Route.extend({ @@ -197,9 +195,7 @@ App.PostsRoute = Ember.Route.extend({ `posts`模板将会接收到一张所有可用的posts清单并将它们当做是上下文环境。 -由于`/posts`映射到一个特定的模型上,所以我们不需要其他额外的信息就可以 -运行。然而,如果我们想要路由映射到某个post上,我们可不想通过在路由器中 -写死每一个可能的post来实现。 +由于`/posts`映射到一个特定的模型上,所以我们不需要其他额外的信息就可以运行。然而,如果我们想要路由映射到某个post上,我们可不想通过在路由器中写死每一个可能的post来实现。 探究_动态段_ From 24a5cb7f13fc148800c9632186d350a8e5ac49a9 Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 17:31:28 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8E=92=E7=89=88?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/bilingual_guides/routing/generated-objects.md | 3 +-- source/guides/routing/generated-objects.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source/bilingual_guides/routing/generated-objects.md b/source/bilingual_guides/routing/generated-objects.md index 7b621e4..ddf85de 100644 --- a/source/bilingual_guides/routing/generated-objects.md +++ b/source/bilingual_guides/routing/generated-objects.md @@ -7,8 +7,7 @@ Ember.js attempts to find corresponding Route, Controller, View, and Template classes named according to naming conventions. If an implementation of any of these objects is not found, appropriate objects will be generated in memory for you. -正如在[定义路由][1]中所说的,无论何时,只要你定义了一个新的路由,`Ember.js`都会试着根据命名惯例 -寻找相对应的路由,控制器,视图还有模板类。一旦有任何一个对象找不到,那么在内存中,相对应的对象将会被生成。 +正如在[定义路由][1]中所说的,无论何时,只要你定义了一个新的路由,`Ember.js`都会试着根据命名惯例寻找相对应的路由,控制器,视图还有模板类。一旦有任何一个对象找不到,那么在内存中,相对应的对象将会被生成。 [1]: /guides/routing/defining-your-routes diff --git a/source/guides/routing/generated-objects.md b/source/guides/routing/generated-objects.md index 2b110f0..63c971d 100644 --- a/source/guides/routing/generated-objects.md +++ b/source/guides/routing/generated-objects.md @@ -1,7 +1,6 @@ 英文原文:[http://emberjs.com/guides/routing/generated-objects/](http://emberjs.com/guides/routing/generated-objects/) -正如在[定义路由][1]中所说的,无论何时,只要你定义了一个新的路由,`Ember.js`都会试着根据命名惯例 -寻找相对应的路由,控制器,视图还有模板类。一旦有任何一个对象找不到,那么在内存中,相对应的对象将会被生成。 +正如在[定义路由][1]中所说的,无论何时,只要你定义了一个新的路由,`Ember.js`都会试着根据命名惯例寻找相对应的路由,控制器,视图还有模板类。一旦有任何一个对象找不到,那么在内存中,相对应的对象将会被生成。 [1]: /guides/routing/defining-your-routes From 1200b92337e13506c520175a8a94918bf2652027 Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 17:37:38 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E8=AF=8D?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bilingual_guides/routing/specifying-a-routes-model.md | 6 +++--- source/guides/routing/specifying-a-routes-model.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/bilingual_guides/routing/specifying-a-routes-model.md b/source/bilingual_guides/routing/specifying-a-routes-model.md index 709664f..4cfd727 100644 --- a/source/bilingual_guides/routing/specifying-a-routes-model.md +++ b/source/bilingual_guides/routing/specifying-a-routes-model.md @@ -69,7 +69,7 @@ objects that represent eventual values. For example, if you use jQuery's eventually returned over the network. Ember uses this promise object to know when it has enough data to continue rendering. -如果对承诺不属性,可以姑且将其认为承诺就是代表了最终加载的数据的对象。例如,使用jQuery的`getJSON`方法,该方法就返回一个代表最终从网络加载的JSON的承诺。Ember使用这个承诺对象知道何时拥有了足够用来渲染的数据。 +如果对承诺不熟悉,可以姑且将其认为承诺就是代表了最终加载的数据的对象。例如,使用jQuery的`getJSON`方法,该方法就返回一个代表最终从网络加载的JSON的承诺。Ember使用这个承诺对象知道何时拥有了足够用来渲染的数据。 For more about promises, see [A Word on Promises](/guides/routing/asynchronous-routing/#toc_a-word-on-promises) @@ -80,7 +80,7 @@ in the Asynchronous Routing guide. Let's look at an example in action. Here's a route that loads the most recent pull requests sent to Ember.js on GitHub: -下面看一个实际的例子。这里有一个从GitHub商获取最近的Ember.js的PR的路由: +下面看一个实际的例子。这里有一个从GitHub上获取最近的Ember.js的PR的路由: ```js App.PullRequestsRoute = Ember.Route.extend({ @@ -115,7 +115,7 @@ the template only displayed the three most recent pull requests. We can rely on promise chaining to modify the data returned from the JSON request before it gets passed to the template: -例如,假设需要修改上例,让模板只显示最近三个PR。通过采用承诺链,可以在将数据传递给模板之前修改请求返回的JSON。 +例如,假设需要修改上例,让模板只显示最近三个PR。通过采用承诺链,可以在将数据传递给模板之前修改请求返回的JSON: ```js App.PullRequestsRoute = Ember.Route.extend({ diff --git a/source/guides/routing/specifying-a-routes-model.md b/source/guides/routing/specifying-a-routes-model.md index d0ba6ca..538d775 100644 --- a/source/guides/routing/specifying-a-routes-model.md +++ b/source/guides/routing/specifying-a-routes-model.md @@ -34,11 +34,11 @@ App.PhotosRoute = Ember.Route.extend({ 在数据是异步加载时,在`model`钩子里面只需要返回一个承诺,Ember就会等待承诺履行后才开始渲染模板。 -如果对承诺不属性,可以姑且将其认为承诺就是代表了最终加载的数据的对象。例如,使用jQuery的`getJSON`方法,该方法就返回一个代表最终从网络加载的JSON的承诺。Ember使用这个承诺对象知道何时拥有了足够用来渲染的数据。 +如果对承诺不熟悉,可以姑且将其认为承诺就是代表了最终加载的数据的对象。例如,使用jQuery的`getJSON`方法,该方法就返回一个代表最终从网络加载的JSON的承诺。Ember使用这个承诺对象知道何时拥有了足够用来渲染的数据。 更多关于承诺的详细介绍,请参看异步路由指南中的[关于承诺](/guides/routing/asynchronous-routing/#toc_a-word-on-promises)部分。 -下面看一个实际的例子。这里有一个从GitHub商获取最近的Ember.js的PR的路由: +下面看一个实际的例子。这里有一个从GitHub上获取最近的Ember.js的PR的路由: ```js App.PullRequestsRoute = Ember.Route.extend({ @@ -54,7 +54,7 @@ App.PullRequestsRoute = Ember.Route.extend({ 因为Ember支持承诺,这使得Ember可以与所有采用承诺作为公共API一部分的持久化库一起工作。此外,利用关于承诺的内置惯例,还可以让代码变得更加清晰。 -例如,假设需要修改上例,让模板只显示最近三个PR。通过采用承诺链,可以在将数据传递给模板之前修改请求返回的JSON。 +例如,假设需要修改上例,让模板只显示最近三个PR。通过采用承诺链,可以在将数据传递给模板之前修改请求返回的JSON: ```js App.PullRequestsRoute = Ember.Route.extend({ From 838a0635e12e454cf33763fa7aca2e7ee9aa8e6f Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 17:41:29 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/guides/routing/setting-up-a-controller.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/guides/routing/setting-up-a-controller.md b/source/guides/routing/setting-up-a-controller.md index f48a72c..edb685b 100644 --- a/source/guides/routing/setting-up-a-controller.md +++ b/source/guides/routing/setting-up-a-controller.md @@ -14,9 +14,8 @@ App.Router.map(function() { }); App.PostRoute = Ember.Route.extend({ - // The code below is the default behavior, so if this is all you - // need, you do not need to provide a setupController implementation - // at all. + // 下面的代码是默认行为,因此如果这就是你想要的, + // 那么你根本不用提供一个 setupController 的实现 setupController: function(controller, model) { controller.set('model', model); } From 671c511b35fa68f8fd3cae8577bff2518491c37d Mon Sep 17 00:00:00 2001 From: yinyong Date: Tue, 9 Dec 2014 17:53:14 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/bilingual_guides/routing/redirection.md | 2 +- source/guides/routing/redirection.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/bilingual_guides/routing/redirection.md b/source/bilingual_guides/routing/redirection.md index f988f90..4fe8dcc 100644 --- a/source/bilingual_guides/routing/redirection.md +++ b/source/bilingual_guides/routing/redirection.md @@ -53,7 +53,7 @@ the redirection, you should either use the `afterModel` or the `redirect` hook. receive the resolved model as the first parameter and the transition as the second one, and thus function as aliases. (In fact, the default implementation of `afterModel` just calls `redirect`.) -如果需要从当前模型中获取重定向的信息来决定跳转到哪里,可以使用`afterModel`和`redirect`这两个钩子来实现。`afterModel`和`redirect`的第一个参数都是路由的模型,过渡对象作为第二个参数,两个钩子本质是一样的。(`afterModel`钩子的缺省实现只是对`redirect`钩子的调用。 +如果需要从当前模型中获取重定向的信息来决定跳转到哪里,可以使用`afterModel`和`redirect`这两个钩子来实现。`afterModel`和`redirect`的第一个参数都是路由的模型,过渡对象作为第二个参数,两个钩子本质是一样的。(实际上`afterModel`钩子的缺省实现只是对`redirect`钩子的调用)。 ```javascript diff --git a/source/guides/routing/redirection.md b/source/guides/routing/redirection.md index 838ef53..8c6df9b 100644 --- a/source/guides/routing/redirection.md +++ b/source/guides/routing/redirection.md @@ -26,7 +26,7 @@ App.IndexRoute = Ember.Route.extend({ ### 在获取模型之后 -如果需要从当前模型中获取重定向的信息来决定跳转到哪里,可以使用`afterModel`和`redirect`这两个钩子来实现。`afterModel`和`redirect`的第一个参数都是路由的模型,过渡对象作为第二个参数,两个钩子本质是一样的。(`afterModel`钩子的缺省实现只是对`redirect`钩子的调用。 +如果需要从当前模型中获取重定向的信息来决定跳转到哪里,可以使用`afterModel`和`redirect`这两个钩子来实现。`afterModel`和`redirect`的第一个参数都是路由的模型,过渡对象作为第二个参数,两个钩子本质是一样的。(实际上`afterModel`钩子的缺省实现只是对`redirect`钩子的调用)。 ```javascript