Files
xk-client-wx/main.js
2026-01-15 12:33:46 +08:00

57 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import App from './App'
import store from './store';
// #ifndef VUE3
import Vue from 'vue'
// main.js
import uView from "uview-ui";
import share from '@/common/share.js'
import {setGuestMode} from "@/common/utils/auth";
Vue.mixin(share)
Vue.use(uView);
//防抖函数
import common from './common/common.js'
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
const token = uni.getStorageSync('token');
const userInfo = uni.getStorageSync('userinfo');
if (!token || !userInfo) {
console.log('未登录')
setGuestMode();
}
//时间戳的处理
Vue.filter("formatDate", function(value) {
var date = new Date(value * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var sdate = ("0" + date.getDate()).slice(-2);
var hour = ("0" + date.getHours()).slice(-2);
var minute = ("0" + date.getMinutes()).slice(-2);
var second = ("0" + date.getSeconds()).slice(-2);
// 拼接
var time = year + "-" + month + "-" + sdate + ' ' + hour + ':' + minute + ':' + second
return time;
})
Vue.config.productionTip = false
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)
return {
app
}
}
// #endif