main.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import App from './App'
  2. // #ifndef VUE3
  3. import Vue from 'vue'
  4. import './uni.promisify.adaptor'
  5. Vue.config.productionTip = false
  6. App.mpType = 'app'
  7. const app = new Vue({
  8. ...App
  9. })
  10. app.$mount()
  11. // #endif
  12. // #ifdef VUE3
  13. import { createSSRApp } from 'vue'
  14. import uviewPlus from 'uview-plus'
  15. import Skeleton from '@/components/CusSkeleton/index.vue'
  16. import LoginRegister from '@/components/pages/loginRegister/index.vue'
  17. import system from '@/common/mixins/system.js'
  18. import { globalProperties } from '@/common/utils/global.js'
  19. import { createPinia } from 'pinia';
  20. export function createApp() {
  21. const app = createSSRApp(App)
  22. const pinia = createPinia();
  23. app.use(pinia);
  24. app.use(uviewPlus)
  25. app.mixin(system)
  26. app.component('u-skeleton', Skeleton)
  27. app.component('login-register', LoginRegister)
  28. for (const key in globalProperties) {
  29. app.config.globalProperties[key] = globalProperties[key]
  30. }
  31. Date.prototype.Format = function (fmt) {
  32. var o = {
  33. "M+": this.getMonth() + 1, // 月份
  34. "d+": this.getDate(), // 日
  35. "h+": this.getHours(), // 小时
  36. "m+": this.getMinutes(), // 分
  37. "s+": this.getSeconds(), // 秒
  38. "q+": Math.floor(( this.getMonth() + 3) / 3), // 季度
  39. "S": this.getMilliseconds() // 毫秒
  40. };
  41. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, ( this.getFullYear() + "").substr(4 - RegExp.$1.length));
  42. for ( var k in o)
  43. if ( new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  44. return fmt;
  45. }
  46. return {
  47. app
  48. }
  49. }
  50. // #endif