# uniapp_template **Repository Path**: yonggecode/uniapp_template ## Basic Information - **Project Name**: uniapp_template - **Description**: uniapp 基于uview和colorUI的移动版本的个人初始化模板,包含了常用的组件和工具函数,即开即用快速初始化项目。 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 3 - **Created**: 2020-10-08 - **Last Updated**: 2021-12-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #### 目录结构 ├─api 封装的接口入口 api ├─colorui 高颜值的 css 组件库 ├─components 公共组件 ├─mixin 全局混入 ├─mock 本地mock文件 ├─pages 页面文件 ├─static 静态文件 │ └─images 图片目录 ├─store VueX 根据需求选用 │ ├─index.js VueX 入口文件 │ └─modules VueX 分模块目录 ├─utils 工具目录 │ ├─http.js 封装的请求 │ └─paymoney 封装的微信支付 ├─uview-ui 高性能多平台快速开发的UI框架 ├─.eslintignore eslint配置忽略文件 ├─App.vue ├─main.js 主入口 ├─pages.json 页面配置 ├─template.h5.html h5 模板文件(不要修改) ├─uni.scss └─vue.config.js vue 配置文件 #### 使用说明 **pages.json** 本模板自定义了顶部导航和底部导航。在性能上可能不及原生,但是扩展性和可塑性更强。可根据需要自行选用 ``` json { // 全局挂载uView 组件 "easycom": { "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" }, //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ { "path": "pages/home/home", "style": { // navigationBarTitleText 本模板没有用原生的navBar 写不写都行 // "navigationBarTitleText": "", "enablePullDownRefresh": false } } ], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "uView", "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8", // 设置配置自定义 tabBar "navigationStyle": "custom" }, "condition": { //模式配置,仅开发期间生效 "current": 0, //当前激活的模式(list 的索引项) "list": [{ "name": "", //模式名称 "path": "", //启动页面,必选 "query": "" //启动参数,在页面的onLoad函数里面得到 }] } } ``` **/pages/home/home** home 页面是入口页面,入口页面做成了单页。底部导航栏的切换通过动态显示组件的形式来展现。 ``` html ``` **main.js** ``` js import Vue from 'vue'; import App from './App'; import store from './store'; Vue.config.productionTip = false App.mpType = 'app' // 引入全局uView import uView from 'uview-ui' Vue.use(uView); // 全局混入分享 import mixinShare from './mixin/share.js'; Vue.mixin(mixinShare) const app = new Vue({ ...App, // 挂载vuex store }) app.$mount() ``` **manifest.json** uni的配置文件,通过 HBuilder 编辑器可使用可视化界面进行配置。