lfox
v0.3.4
Published
ngx-admui快速开发辅助工具
Downloads
13
Readme
ngx-admui 项目配套命令行工具lifox
工具特征:
- 基于node完成,不需要额外安装其他软件。
- 可快速创建ngx-admin项目。
- 可快速添加模块【module】、视图【view】,组件【component】,服务【service】,指令【directive】,管道【pipe】、模态框【modal】。
- 自动注入项目所有widget,并完成路由配置。
- 每种widget据提供多种类型供选择。
项目说明:
该工具基于node完成,可有效减轻项目开发过程中重复的工作,加快项目开发进度,使开发者能够更加专注于项目业务逻辑。~~由于该工具目前为私有,所以暂未发布npm,使用请clone到本地,运行npm link构建本地命令~~。
错误编码:
101:视图已存在。
102:className只能由英文构成。
预置命令
|指令| 注解 | |---------|--| |lf new [projectName]| 新建ngx-admui项目,自动安装npm依赖并打包生成动态依赖dll | |lf add [type]| 添加项目widget,目前可以创建view、component、service、directive、pipe、modal,并自动注入到项目里,该命令只能在ngx-admui根目录进行使用 | |lf inject| 重新注入项目widget,同时生成路由配置,该命令只能在ngx-admui根目录进行使用,可选参数,-m '模块名称',若无指定-m则会重新注入项目所有widget。需要注意的是若路径下有init路由目录,则工具会把该路由页面作为默认路由页面。 | |lf --help| 查看工具帮助说明 | |lf add --help| 查看lf add操作帮助说明 |
lf add <type>指令说明
|参数| 注解 | |--|--| | type | 目标widget的类型,可选值 view、component、service、directive、pipe、modal| | -c / --className | 目标widget的类名,按照书写习惯须由英文字母构成 | | -t / --type | 目标widget种类,默认为default,其中view可选值:【default、root、outlet、list、form】;service可选值:【default】;component可选值:【defulat、form】;directive可选值:【default】;modal可选值:【default、list、form】;pipe可选值:【default】 | | -m / --module | 目标widget所属模块 | | -p / --path | 目标widget路径,该参数只有创建view的时候会用到,默认为“”,即views目录根级 | | --title | 视图标题,默认为“默认标题”,该参数只有创建view的时候会用到 | | --icon| 视图图标,默认为“wb-emoticon”,该参数只有创建view的时候会用到 | | --redirect| 视图重定向,可用值为path参数值(视图路径),默认为“”即不进行重定向,该参数只有创建view的时候会用到 | | --params| 视图参数,默认为“”,示例 id:1,pageNum:1,typeId",该参数只有创建view的时候会用到 | | --sort| 视图排序,默认为0,视图按sort升序排列,该参数只有创建view的时候会用到 | | --outlet| 是否为tab节点,默认为false,该参数只有创建view的时候会用到 | | --hide| 是否在导航栏显示该视图,默认为false,该参数只有创建view的时候会用到 |
lf add <type>示例说明
【service】
lf add service -c Test
生成一个名为TestService的公用服务
lf add service -c Test -m admin
为admin模块生成一个名为TestService的服务
【component】
lf add component -c Test
生成一个名为Test的公用组件
lf add component -c Test -t form
生成一个名为Test的公用组件,其类型为form,即为form组件,可以使用双向绑定
lf add component -c Test -t form -m admin
为admin模块生成一个名为Test的组件,其类型为form,即为自定义form组件,可以使用双向绑定
【pipe】
lf add pipe -c Test
生成一个名为Test的公用管道
lf add pipe -c Test -m admin
为admin模块生成一个名为Test的管道
【modal】
lf add modal -c Test
生成一个名为Test的公用模态框
lf add modal -c Test -t form
生成一个名为Test的公用组件,其类型为form,即为form组件,可以使用双向绑定
lf add modal -c Test -t form -m admin
为admin模块生成一个名为Test的组件,其类型为form,其html部分自动套用表单结构
【directive】
lf add directive -c Test
生成一个名为Test的公用指令
lf add directive -c Test -m admin
为admin模块生成一个名为Test的指令
【view】
lf add view -c Test -m admin --title 测试 --icon wb-home
为admin模块生成一个目录为test、名称为“测试”、图标为“wb-home”的视图,该视图的访路路由path为/admin/test
lf add view -c Test -m admin -t root --redirect test.other
为admin模块生成一个目录为/views/test的视图,因为ngx-admui整体设计为0-1-1导航,即一级导航默认不做视图使用,所以建议如果目标视图为一级,需要选择type类型是root,同时指定视图重定向到其他视图 。
lf add view -c Other -m admin -p test --title 其他 --icon wb-other --redirect test.other.list
为admin模块生成一个目录为/views/test/other、名称为“其他”、图标为“wb-other”的视图,该视图的访问路由path为/admin/other,并重定向到test.other.list视图
lf add view -c List -m admin -p test.other --title 列表 --icon wb-list --type list --params pageNum:1,typeId:2 --outlet
为admin模块生成一个目录为/views/test/other/list、名称为“其他”、图标为“wb-other”的视图,且为tab节点,该视图的访问路由path为/admin/other/list/:pageNum/:typeId,默认url为/admin/other/list/1/2
lf add view -c Detail -m admin -p test.other --title 详情 --icon wb-detail --params id
为admin模块生成一个目录为/views/test/other/detail、名称为“详情”、图标为“wb-detail ”的视图,且为tab节点,该视图的访问路由path为/admin/other/detail/:id,默认url为/admin/other/detail/<id> id不能为空。
lf add view -c OutLet -m admin
lf add view -c init -m admin -p outLet
为admin模块生成一个目录为/views/outlet/,其默认会显示目录下的init子级目录