main.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. });
  53. Vue.filter("nameFilter", function (value) {
  54. if (value) {
  55. let start = new Array(value.length).join('*');
  56. let end = value.slice(0,1);
  57. return `${end}${start}`
  58. } else {
  59. return "";
  60. }
  61. });
  62. Vue.filter("phoneFilter", function (value) {
  63. if (value) {
  64. let reg = /^(.{3}).*(.{4})$/
  65. return value.replace(reg,'$1****$2')
  66. } else {
  67. return "";
  68. }
  69. });