Skip to content

Commit 26ef8da

Browse files
authored
Update angular-best-practices.md
1 parent 94d4019 commit 26ef8da

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

frontend/angular-best-practices.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,16 @@ this.service
247247
}
248248
// #endregion
249249
```
250+
251+
## Templates 风格指南
252+
253+
- **Template**保持足够简单,尽量避免计算以及表达式,如若需要,可将其移到**Component**里面使用计算属性表示:
254+
```ts
255+
export class DemoComponent {
256+
/// 此处略去其他代码
257+
258+
get isVisible() {
259+
return this.list.length > 0 && balabala……
260+
}
261+
}
262+
```

0 commit comments

Comments
 (0)