diff --git a/public/docs/ts/latest/guide/style-guide.jade b/public/docs/ts/latest/guide/style-guide.jade index cd8965f0c1..bc941a6626 100644 --- a/public/docs/ts/latest/guide/style-guide.jade +++ b/public/docs/ts/latest/guide/style-guide.jade @@ -1094,19 +1094,28 @@ a(href="#toc") 回到顶部 a(href="#toc") Back to top +a(href="#toc") 回到顶部 + + .l-main-section :marked ### Import Destructuring Spacing + ### 导入语句解构表达式中的空格 #### Style 03-05 + #### 风格03-05 .s-rule.do :marked **Do** leave one whitespace character inside of the `import` statements' curly braces when destructuring. + **坚持**解构时,在`import`声明的大括号里留一个空格字符。 + .s-why.s-why-last :marked **Why?** Whitespace makes it easier to read the imports. + **为何?**空格让import声明更易于阅读。 + +makeExample('style-guide/ts/03-05/app/+heroes/shared/hero.service.avoid.ts', 'example', 'app/+heroes/shared/hero.service.ts')(avoid=1) :marked @@ -1115,6 +1124,8 @@ a(href="#toc") Back to top a(href="#toc") Back to top +a(href="#toc") 回到顶部 + .l-main-section :marked ### Import Line Spacing @@ -1777,28 +1788,41 @@ a(href="#toc") 回到顶部 a(href="#toc") Back to top +a(href="#toc") 回到顶部 + + .l-main-section :marked ### Prefix Lazy Loaded Folders with + + ### 为惰性加载目录名字加前缀+ #### Style 04-12 + #### 样式04-12 .s-rule.do :marked **Do** prefix the name of a *lazy loaded folder* with a (+) e.g., `+dashboard/`. + **坚持**使用一个(+)前缀来标记*惰性加载目录*名字,比如`+dashboard/`。 + .s-why :marked **Why?** Lazy loaded code paths are easily identifiable by their `+` prefix. + **为何?**通过`+`前缀,惰性加载的源代码可以很容易被识别。 + .s-why :marked **Why?** Lazy loaded code paths are easily distinguishable from non lazy loaded paths. + **为何?**惰性加载路径和非惰性加载的路径很容易被区分开来。 + .s-why.s-why-last :marked **Why?** If we see an `import` path that contains a `+`, we can quickly refactor to use lazy loading. -.example-title Lazy Loaded Folders + **为何?**如果看到包含`+`的`import`路径,我们能快速使用惰性加载进行重构。 + +.example-title Lazy Loaded Folders 惰性加载目录 .filetree .file src .children @@ -1812,6 +1836,8 @@ a(href="#toc") Back to top a(href="#toc") Back to top +a(href="#toc") 回到顶部 + .l-main-section :marked ### Never Directly Import Lazy Loaded Folders @@ -1829,6 +1855,8 @@ a(href="#toc") Back to top :marked **Why?** Directly importing a module loads it immediately when our intention is to load it on demand. + **为何?**直接导入模块会立刻加载它,但是我们的原意是按需加载。 + +makeExample('style-guide/ts/04-13/app/app.component.avoid.ts', 'example', 'app/app.component.ts')(avoid=1) :marked @@ -1860,19 +1888,28 @@ a(href="#toc") 回到顶部 a(href="#toc") Back to top +a(href="#toc") 回到顶部 + + .l-main-section :marked ### Use Component Router to Lazy Load + ### 使用组件路由器来惰性加载 #### Style 04-15 + #### 风格04-15 .s-rule.do :marked **Do** use the Component Router to lazy load routable features. + **坚持**使用组件路由器来惰性加载可以路由的特性。 + .s-why.s-why-last :marked **Why?** That's the easiest way to load a module on demand. + **为何?**这是最简单的按需加载模块的方法。 + a(href="#toc") Back to top a(href="#toc") 回到顶部