main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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() < 10 ? '0' + time.getHours() : time.getHours();
  46. const mm = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes();
  47. const s = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds();
  48. // return h + ":" + mm + ":" + s;
  49. return h + ":" + mm;
  50. } else {
  51. return "";
  52. }
  53. });
  54. Vue.filter("nameFilter", function (value) {
  55. if (value) {
  56. let start = new Array(value.length).join('*');
  57. let end = value.slice(0,1);
  58. return `${end}${start}`
  59. } else {
  60. return "";
  61. }
  62. });
  63. Vue.filter("phoneFilter", function (value) {
  64. if (value) {
  65. let reg = /^(.{3}).*(.{4})$/
  66. return value.replace(reg,'$1****$2')
  67. } else {
  68. return "";
  69. }
  70. });