feat: 🎨 在config中新增5个便捷功能选项,更加简单便捷配置以及使用代码。优化部分冗余的代码

This commit is contained in:
学习很差啦
2022-10-10 18:53:14 +08:00
parent 1225a41de4
commit 7179ca41de
19 changed files with 100 additions and 168 deletions

19
main.js
View File

@@ -3,17 +3,18 @@ import App from "./App";
import * as filters from "./utils/filters.js"; // global filter
import uView from "uview-ui";
import store from "./store";
import config from '@/config/config';
import airBtn from "@/components/m-airbtn/index.vue";
/**
* 仅在h5中显示唤醒app功能
* 在h5页面手动挂载
*
*/
// #ifdef H5
import airBtn from "@/components/m-airbtn/index.vue";
let btn = Vue.component("airBtn", airBtn); //全局注册
document.body.appendChild(new btn().$mount().$el);
if(config.enableMiniBarStartUpApp){
let btn = Vue.component("airBtn", airBtn); //全局注册
document.body.appendChild(new btn().$mount().$el);
}
// #endif
// 引入uView对小程序分享的mixin封装
@@ -30,8 +31,6 @@ Object.keys(filters).forEach((key) => {
// 引入Vuex
Vue.prototype.$store = store;
Vue.use(uView);
Vue.config.productionTip = false;
@@ -43,11 +42,11 @@ Vue.config.productionTip = false;
* 如需更换主题请修改此处以及uni.scss中的全局颜色
*/
// 主题色
Vue.prototype.$mainColor = "#ff3c2a";
Vue.prototype.$mainColor = config.mainColor;
// 高亮主题色
Vue.prototype.$lightColor = "#ff6b35";
Vue.prototype.$lightColor = config.lightColor;
// 辅助高亮颜色
Vue.prototype.$aiderLightColor = "#ff9f28";
Vue.prototype.$aiderLightColor = config.aiderLightColor;
App.mpType = "app";