# 脚手架模式
公测中 hatom脚手架模式开发,使用hatom2-cli脚手架(v2.3.0+)# 开始
全局模式:
hatom init uni-tpl hello
非全局模式:
npx hatom init uni-tpl hello
# 选配
# ? 项目名称(hello)
<enter>
# ? 项目描述(A hatom project)
hello project
# ? 版本(1.0.0)
<enter>
# 作者 (support.hikyun@hikvision.com.cn)
<enter>
# ? 安装vuex(Y/n)
<enter>
# ? 路由组件(Use arrow.keys)
> uni官方推荐的路由,不安装其他插件
一个完全相似Vue-router的路由插件
<enter>
# ? request请求(Use arrow keys)
> uni官方开放的request,不安装其他插件
使用axios封装request
<enter>
# 运行
下载安装HBuilderX工具下载 (opens new window)
打开导入到HBuilderX工具
右键->本地导入->选择脚手架生成的模板工程
导入模板工程如下:
# 目录
├── assets ·································· 资源文件目录
│ ├── icons ······························· 图标、可自动生成雪碧图
│ ├── images ······························ 图片
│ │ └── sprite.png ······················ 雪碧图
│ └── styles ······························ 样式
│ ├── animation.css ··················· 动画样式
│ ├── reset.css ······················· 重置样式表
│ └── sprite.css ······················ 雪碧图样式
│
├── components ······························ 公共组件
│ ├── i-button ······························· button组件
│ │ └── i-button.vue
│ ├── utils
│ │ ├── reg.js ·························· 公共正则
│ │ └── util.js ························· 公共方法
│ └── index.js ···························· 封装
│
├── config ·································· 业务配置
│ ├── api.js ······························ 接口地址
│ ├── constant.js ························· 全局常量
│ ├── http.js ····························· axios封装
│ ├── index.js ···························· 封装
│ └── webApp.json ························· app配置
│
├── corejs ·································· hatom封装
│ ├── hatom.js
│ └── pageRouter.json
|
├── dist ·································· uni-plugin
│ ├── gangdiedao-uni-axios
│ └── uni-simple-router
|
├── node_modules ·························· npm-plugin
│
|
├── pages ··································· 应用页面
│ ├── index ······························· 首页
│ │ └── index.vue
| |
│ ├── page1 ······························· 列表页面
│ │ ├── detail.vue
│ │ └── index.vue
| |
│ └── plugin ······························ 插件页面
| ├── comonents
│ └── index.vue
|
├── router ·································· 路由配置
│ └── index.js
├── store ··································· vuex配置
│ ├── actions.js
│ ├── getters.js
│ ├── index.js
│ ├── mutations.js
│ └── state.js
│
├── App.vue ································· 根组件
│
│
└── main.js ································· 入口
│
│
├── .gitignore ····························· git白名单
│
│
├── webpack.config.js ······················ webpack配置
│
├── package-lock.json ······················ package-lock.json
│
└── package.json ··························· package.json
# demo工程
下载命令:
hatom init uni-demo hello