你们习惯给每个 component 都建一个独立的目录吗?为什么?

2022-04-18 19:13:51 +08:00
 rv54ntjwfm3ug8

本来应该发 Angular 节点的,但那里太冷清了就挪过来了

1 )

.\layout\layout.component.[css|ts|html|spec.ts]
.\layout\side-nav.component.[css|ts|html|spec.ts]
.\layout\top-bar.component.[css|ts|html|spec.ts]

还是 2 )

.\layout\layout.component.[css|ts|html|spec.ts]
.\layout\side-nav\side-nav.component.[css|ts|html|spec.ts]
.\layout\top-bar\top-bar.component.[css|ts|html|spec.ts]

又或是 3 ):

.\layout\layout\layout.component.[css|ts|html|spec.ts]
.\layout\side-nav\side-nav.component.[css|ts|html|spec.ts]
.\layout\top-bar\top-bar.component.[css|ts|html|spec.ts]

或者还有第 4 种?

1227 次点击
所在节点    前端开发
6 条回复
a935855375
2022-04-18 19:17:42 +08:00
第二种,结构层次最舒服
Chism
2022-04-18 21:22:20 +08:00
react 和 vue 我会,这样 css 等自用的文件避免跟其它混淆,ag 没用过。。
wunonglin
2022-04-18 21:58:11 +08:00
2.每个组件一个目录,或者每个模块一个目录,针对 ng
susan0007
2022-04-19 17:15:07 +08:00
我用 react 会选择第一种,因为只有一个 tsx 文件。
对于组件文件数量大于 2 的,我会选第二种。
sjhhjx0122
2022-04-20 16:38:31 +08:00
第二种啊
renhou
2022-04-28 11:04:18 +08:00
比较常用第二种

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/847730

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX