main.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 {
  14. createSSRApp
  15. } from 'vue'
  16. import uviewPlus from 'uview-plus'
  17. import Skeleton from '@/components/CusSkeleton/index.vue'
  18. import system from '@/common/mixins/system.js'
  19. import { globalProperties } from '@/common/utils/global.js'
  20. export function createApp() {
  21. const app = createSSRApp(App)
  22. app.use(uviewPlus)
  23. app.mixin(system)
  24. app.component('u-skeleton', Skeleton)
  25. for (const key in globalProperties) {
  26. app.config.globalProperties[key] = globalProperties[key]
  27. }
  28. Date.prototype.Format = function (fmt) {
  29. var o = {
  30. "M+": this.getMonth() + 1, // 月份
  31. "d+": this.getDate(), // 日
  32. "h+": this.getHours(), // 小时
  33. "m+": this.getMinutes(), // 分
  34. "s+": this.getSeconds(), // 秒
  35. "q+": Math.floor(( this.getMonth() + 3) / 3), // 季度
  36. "S": this.getMilliseconds() // 毫秒
  37. };
  38. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, ( this.getFullYear() + "").substr(4 - RegExp.$1.length));
  39. for ( var k in o)
  40. if ( new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  41. return fmt;
  42. }
  43. return {
  44. app
  45. }
  46. }
  47. // #endif