lilishop-uniapp/main.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-05-13 11:03:32 +08:00
import Vue from "vue";
import App from "./App";
import * as filters from "./utils/filters.js"; // global filter
import uView from "uview-ui";
import store from "./store";
// #ifdef H5
// 在h5页面手动挂载 h5唤醒app插件
import airBtn from "@/components/m-airbtn/index.vue";
let btn = Vue.component("airBtn", airBtn); //全局注册
document.body.appendChild(new btn().$mount().$el);
// #endif
2021-06-04 18:11:34 +08:00
2021-05-13 11:03:32 +08:00
Object.keys(filters).forEach((key) => {
Vue.filter(key, filters[key]);
});
const msg = (title, duration = 1500, mask = false, icon = "none") => {
//统一提示方便全局修改
if (Boolean(title) === false) {
return;
}
uni.showToast({
title,
duration,
mask,
icon,
});
2021-06-04 18:11:34 +08:00
};
2021-05-13 11:03:32 +08:00
// 引入vuex
2021-06-04 18:11:34 +08:00
Vue.prototype.$store = store;
2021-05-13 11:03:32 +08:00
Vue.use(uView);
2021-06-04 18:11:34 +08:00
Vue.config.productionTip = false;
2021-05-13 11:03:32 +08:00
// 主题色
2021-06-04 18:11:34 +08:00
Vue.prototype.$mainColor = "#ff3c2a";
2021-05-13 11:03:32 +08:00
// 高亮主题色
2021-06-04 18:11:34 +08:00
Vue.prototype.$lightColor = "#ff6b35";
2021-05-13 11:03:32 +08:00
// 可直接 this.$api调用
Vue.prototype.$api = { msg };
App.mpType = "app";
const app = new Vue({
...App,
});
app.$mount();