V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
rv54ntjwfm3ug8

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

  •  
  •   rv54ntjwfm3ug8 · Apr 18, 2022 · 1833 views
    This topic created in 1471 days ago, the information mentioned may be changed or developed.

    本来应该发 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 种?

    6 replies    2022-04-28 11:04:18 +08:00
    a935855375
        1
    a935855375  
       Apr 18, 2022
    第二种,结构层次最舒服
    Chism
        2
    Chism  
       Apr 18, 2022 via Android
    react 和 vue 我会,这样 css 等自用的文件避免跟其它混淆,ag 没用过。。
    shakaraka
        3
    shakaraka  
    PRO
       Apr 18, 2022
    2.每个组件一个目录,或者每个模块一个目录,针对 ng
    susan0007
        4
    susan0007  
       Apr 19, 2022
    我用 react 会选择第一种,因为只有一个 tsx 文件。
    对于组件文件数量大于 2 的,我会选第二种。
    linkopeneyes
        5
    linkopeneyes  
       Apr 20, 2022
    第二种啊
    renhou
        6
    renhou  
       Apr 28, 2022
    比较常用第二种
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1034 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 22:07 · PVG 06:07 · LAX 15:07 · JFK 18:07
    ♥ Do have faith in what you're doing.