UNPKG

@ne_fe/page-cli

Version:

generate page by json

67 lines (53 loc) 1.75 kB
### 简介 利用命令行与JSON配置,生成最简单的dashboard增删改查页面,具体业务需求还需进行具体修改。 ### 安装&配置 ```bash $ npm i -g ne-page-cli ``` ### 使用 #### 先准备好json配置,放在哪里都可以 ```json // {root}/devDep/data.json { "search": { "type": "normal", "field": { "name": "姓名", "age": "年龄" } }, "table": { "field": { "name": "姓名", "age": "年龄", "createTime": "创建时间" } }, "modal": { "field": { "name": "姓名", "age": "年龄", "status": "状态" } } } ``` - search.type有两种值可选: - 1.normal:普通搜索表单,建议表单少的时候使用(一行可以排完的情况) - 2.form:Form搜索表单,建议表单多的时候使用(一行不能排完的情况) #### 执行命令行 ```bash ne-page -c ./devDep/data.json -p ./client/page/admin/HelloDashboard.vue ``` #### ne-page -h 可查看帮助 ```bash Options: -V, --version output the version number -c, --config <configPath> required, the path of the JSON configuration -p, --path <filePath> The path(include name) of the file you want to generate -h, --help output usage information ``` #### 注意事项 * 1.config配置路径必须配置,且为标准的json格式,例子中的字段都必填。search和modal字段会生成Input组件,modal字段会默认加必填校验,table字段会生成key、title,按需修改即可。 * 2.path文件路径可以不配,将会执行目录下生成在Unknown.vue * 3.期望在工程根目录下并且安装eslint后执行该命令,否则eslint修复文件则会失败