main.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import App from "./App";
  2. // #ifndef VUE3
  3. import Vue from "vue";
  4. import footTabs from "./components/foot-tabs/footTabs.vue";
  5. Vue.component("footTabs", footTabs); //挂载
  6. Vue.config.productionTip = false;
  7. App.mpType = "app";
  8. const app = new Vue({
  9. ...App,
  10. });
  11. app.$mount();
  12. // #endif
  13. // #ifdef VUE3
  14. import {createSSRApp} from "vue";
  15. export function createApp() {
  16. const app = createSSRApp(App);
  17. return {
  18. app,
  19. };
  20. }
  21. // #endif
  22. Vue.filter("globalTime", function (value) {
  23. if (value) {
  24. const time = new Date(value * 1000);
  25. const y = time.getFullYear();
  26. const m =
  27. time.getMonth() + 1 < 10
  28. ? "0" + (time.getMonth() + 1)
  29. : time.getMonth() + 1;
  30. const d = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
  31. // const h = time.getHours()
  32. // const mm = time.getMinutes();
  33. // const s = time.getSeconds();
  34. return y + "-" + m + "-" + d;
  35. } else {
  36. return "";
  37. }
  38. });
  39. Vue.filter("globalTimeSecond", function (value) {
  40. if (value) {
  41. const time = new Date(value * 1000);
  42. // const y = time.getFullYear();
  43. // const m = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1);
  44. // const d = time.getDate() < 10 ? '0' + time.getDate(): time.getDate();
  45. const h = time.getHours();
  46. const mm = time.getMinutes();
  47. const s = time.getSeconds();
  48. return h + ":" + mm + ":" + s;
  49. } else {
  50. return "";
  51. }
  52. });