import App from './App' import store from './store' // 引入封装的接口api import common from "./common/common.js"; import { myRequest } from './common/requestServer.js' //引入封装的过滤器 filters import * as filters from './common/filters.js' // 挂在Vue属性 全局通过this.$myRequest()可以访问到 Vue.prototype.$common = common Vue.prototype.$myRequest = myRequest // 添加全局filter Object.keys(filters).map(v => { Vue.filter(v, filters[v]) }) // #ifndef VUE3 import Vue from 'vue' Vue.config.productionTip = false Vue.prototype.$store = store Vue.prototype.$adpid = "1111111111" Vue.prototype.$backgroundAudioData = { playing: false, playTime: 0, formatedPlayTime: '00:00:00' } Vue.filter('priceFormat', function(value, arg) { return (value / 100).toFixed(2) }) Vue.filter('timeFormat', function(value, arg) { var time = ''; if (null != value && "" != value) { var timer = parseInt(value); if (timer == 0) { return '0秒'; } var days = parseInt(timer / (60 * 60 * 24)); var hours = parseInt((timer % (60 * 60 * 24)) / (60 * 60)); var minutes = parseInt((timer % (60 * 60)) / (60)) var seconds = parseInt(timer % (60)); if (days > 0) { time = time + days +'天'; } if (hours > 0) { time = time + hours +'小时'; } if (minutes > 0) { time = time + minutes +'分钟'; } if (seconds > 0) { time = time + seconds +'秒'; } return time; } return time; }) Vue.prototype.getGlobalUser = function(key) { var userInfo = uni.getStorageSync("globalUser"); if (userInfo != null && userInfo != "" && userInfo != undefined) { return userInfo; } else { return null; } } Vue.prototype.getWxOpenid= function(key) { var WxOpenid = uni.getStorageSync("WxOpenid"); if (WxOpenid != null && WxOpenid != "" && WxOpenid != undefined) { return WxOpenid; } else { return ""; } } App.mpType = 'app' const app = new Vue({ store, ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) app.use(store) app.config.globalProperties.$adpid = "1111111111" app.config.globalProperties.$backgroundAudioData = { playing: false, playTime: 0, formatedPlayTime: '00:00:00' } return { app } } // #endif