Skip to content

Commit

Permalink
fix: umi g component file name (#11669)
Browse files Browse the repository at this point in the history
  • Loading branch information
fz6m authored Sep 21, 2023
1 parent dad6dc1 commit 0bb177d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions docs/docs/docs/guides/generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,32 +173,32 @@ $umi g page foo --fallback
$umi g component
✔ Please input you component Name … foo
Write: src/components/Foo/index.ts
Write: src/components/Foo/Foo.tsx
Write: src/components/Foo/component.tsx
```

直接生成:
```bash
$umi g component bar
Write: src/components/Bar/index.ts
Write: src/components/Bar/Bar.tsx
Write: src/components/Bar/component.tsx
```

嵌套生成:
```bash
$umi g component group/subgroup/baz
Write: src/components/group/subgroup/Baz/index.ts
Write: src/components/group/subgroup/Baz/Baz.tsx
Write: src/components/group/subgroup/Baz/component.tsx
```

批量生成:
```bash
$umi g component apple banana orange
Write: src/components/Apple/index.ts
Write: src/components/Apple/Apple.tsx
Write: src/components/Apple/component.tsx
Write: src/components/Banana/index.ts
Write: src/components/Banana/Banana.tsx
Write: src/components/Banana/component.tsx
Write: src/components/Orange/index.ts
Write: src/components/Orange/Orange.tsx
Write: src/components/Orange/component.tsx
```

#### 对组件模板内容进行自定义
Expand Down
4 changes: 2 additions & 2 deletions packages/preset-umi/templates/generate/component/index.ts.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {{{compName}}} from './{{{compName}}}'
import {{{compName}}} from './component'

export default {{{compName}}}
export * from './{{{compName}}}'
export * from './component'

1 comment on commit 0bb177d

@vercel
Copy link

@vercel vercel bot commented on 0bb177d Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.