diff --git a/bin/gen.ts b/bin/gen.ts index cb73fb8..ca80241 100644 --- a/bin/gen.ts +++ b/bin/gen.ts @@ -2,8 +2,8 @@ * @Author: zhaojinfeng 121016171@qq.com * @Date: 2023-06-20 16:46:04 * @LastEditors: zhaojinfeng 121016171@qq.com - * @LastEditTime: 2023-06-21 10:56:31 - * @FilePath: \tianheng-design\bin\GEN.TS + * @LastEditTime: 2023-07-18 11:04:47 + * @FilePath: \vue3\bin\gen.ts * @Description: * */ @@ -32,13 +32,18 @@ async function rendenVUE(data: RenderData) { } co(function*() { - const name: string = yield coprompt('起一个组件英文名称(不区分大小写): ') - if (!name) + const input: string = yield coprompt('起一个组件英文名称(不区分大小写): ') + + if (!input) throw new Error('不能创建') - const lowerName = name.toLowerCase() - const first = lowerName[0] - const component = first.toUpperCase() + lowerName.slice(1) + const lowerName = input.toLowerCase() + let component = '' + + input.split('-').forEach((name) => { + const first = name[0] + component += first.toUpperCase() + name.slice(1) + }) const data = { lowerName, component } Promise .all([rendenStories(data), rendenVUE(data)])