generator-umi-all
v1.2.0
Published
> 全局安装yoeman ``` yarn add global yo ```
Downloads
98
Readme
umi-all
全局安装yoeman
yarn add global yo
安装模块依赖
yarn add yeoman-generator --dev
更新
本地更新,yarn link到仓库
使用:
yo umi-all 创建基本文件目录
基本目录
|- src
|- assets
// 图片资源
|- components
|- Footer // 共用组件
|- Header // 共用组件
|- Part // 共用组件
|- layouts
|- index.js // 通用模板
|- models
|- home.js // redux数据仓库
|- pages
|- document.ejs // html模板
|- index.js // 项目入口文件
|- service // 请求
|- config.js // 本地、打包请求包装
|- request.js // 请求封装
|- home.js // 事例
|- utils // 工具函数
|- app.js // dva配置
|- .editorconfig
|- .env
|- .eslintrc
|- .prettierignore
|- .prettierrc
|- .umirc.js
|- package.json
|- webpack.config.js
通用函数
/utils/index.js
getOS() // 获取操作系统
Browse() // 获得浏览器属性
arrayShuffle() // 打乱数组
isUrl() // 判断是否是url
isBase64() // 判断base64
addHttp() // 链接默认添加http头
getRandom() // 获取指定范围随机数
formatSize() // 文件尺寸格式化
once() // 只执行一次函数,防抖
minName() // 缩减长文件名称
downloadFile() // 下载文件,通用
acceptFileType // 自定义上传可接受文件格式
第一步:封装基本文件夹目录
简单的拷贝项目工作基本文件目录 √
第二步:封装工作流
将依赖npm包及项目优化代码封装,最终暴露打包运行方式(类似umi)ing...
第三步:自定义工作流
可扩充,可自定义式工作流 loading...