Skip to content

Commit

Permalink
fix: umi g component file name
Browse files Browse the repository at this point in the history
  • Loading branch information
fz6m committed Sep 20, 2023
1 parent f8b6f10 commit 72ea640
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'

0 comments on commit 72ea640

Please sign in to comment.