import Vue from 'vue' import App from './App' //异步请求 import api from '@/common/api' Vue.prototype.$api = api import store from './store' Vue.prototype.$store = store //提示框 import layer from '@/common/layer' Vue.prototype.$layer = layer // 页面跳转 import * as navTo from '@/common/navTo' Vue.prototype.$navTo = navTo // 验证登入有效等... import method from '@/common/methodTool' Vue.prototype.$method = method import filters from './filters/index.js' //import share from '@/js_sdk/share.js' //Vue.mixin(share) import uView from "uview-ui"; Vue.use(uView); // 全局过滤器 // Object.keys(filters).forEach((filterName) => { // console.log('filterName', filterName, Vue) // Vue.filter(filterName, filters[filterName]) // }) Vue.filter('formate', function(time, formate = 'yyyy-mm-dd hh:mm:ss') { var padDate = function (va) { va = va < 10 ? '0' + va : va return va } if (time) { var value = new Date(time * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 // var value = new Date(parseFloat(time)) var year = value.getFullYear() var month = padDate(value.getMonth() + 1) var day = padDate(value.getDate()) var hour = padDate(value.getHours()) var minutes = padDate(value.getMinutes()) var seconds = padDate(value.getSeconds()) let res = '' switch (formate) { case 'mm-dd': { res = month + '-' + day break } case 'yyyy-mm-dd': { res = year + '-' + month + '-' + day break } case 'yyyy-mm': { res = year + '-' + month break } case 'mm月dd日': { res = month + '月' + day + '日' break } case 'yyyy年mm月dd日': { res = year + '年' + month + '月' + day + '日' break } case 'yyyy年mm月': { res = year + '年' + month + '月' break } case 'hh:mm': { res = hour + ':' + minutes break } case 'yyyy-mm-dd hh:mm': { res = year + '-' + month + '-' + day + ' ' + hour + ':' + minutes break } case 'yyyy.mm.dd': res = year + '.' + month + '.' + day break case 'yyyy-mm-dd hh:mm:ss': default: { res = year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds break } } return res } return '--' }); Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) app.$mount()