123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import Vue from 'vue'
- import App from './App'
- import uView from "uview-ui";
- Vue.use(uView);
- // ColorUI的 导航栏
- import cuCustom from './colorui/components/cu-custom.vue'
- Vue.component('cu-custom',cuCustom)
- import comSelectPicture from './components/comSelectPicture/comSelectPicture.vue'
- Vue.component('com-select-picture',comSelectPicture)
- // 此处为演示vuex使用,非uView的功能部分
- import store from '@/store';
- // 引入uView提供的对vuex的简写法文件
- let vuexStore = require('@/store/$u.mixin.js');
- Vue.mixin(vuexStore);
- App.mpType = 'app'
- // 全局过滤器 -- 金额保留两位
- Vue.filter('moneyFilter', function (value) {
- if (!value || isNaN(value)) return 0.0
- return new Number(value).toFixed(1)
- })
- const app = new Vue({
- ...App
- })
- const msg = (title, duration=1500, mask=false, icon='none')=>{
- //统一提示方便全局修改
- if(Boolean(title) === false){
- return;
- }
- uni.showToast({
- title,
- duration,
- mask,
- icon
- });
- }
- const json = type=>{
- //模拟异步请求数据
- return new Promise(resolve=>{
- setTimeout(()=>{
- resolve(Json[type]);
- }, 500)
- })
- }
- const prePage = ()=>{
- let pages = getCurrentPages();
- let prePage = pages[pages.length - 2];
- // #ifdef H5
- return prePage;
- // #endif
- return prePage.$vm;
- }
- Vue.prototype.$fire = new Vue();
- Vue.prototype.$store = store;
- Vue.prototype.$api = {msg, json, prePage};
- // http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
- import httpInterceptor from '@/common/http.interceptor.js'
- Vue.use(httpInterceptor, app)
- // http接口API集中管理引入部分
- import httpApi from '@/api/http.api.js'
- Vue.use(httpApi, app)
- import common from '@/common/common.js'
- Vue.prototype.$formatPhone = common.formatPhone;
- Vue.prototype.$formatName = common.formatName;
- Vue.prototype.$videoList = common.videoList;
- app.$mount()
|