main.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import Vue from 'vue'
  2. import App from './App'
  3. Vue.config.productionTip = false
  4. // import uView from "uview-ui";
  5. // Vue.use(uView);
  6. import md5 from 'js-md5';
  7. Vue.prototype.$md5 = md5;
  8. import dayjs from 'dayjs';
  9. Vue.prototype.$day = dayjs;
  10. import cof from '@/static/config/in';
  11. Vue.prototype.$cof = cof;
  12. // 微信全局分享
  13. import share from '@/utils/share.js'
  14. Vue.mixin(share)
  15. // js高精度计算
  16. import highPrecision from "@/utils/highPrecision";
  17. Vue.prototype.$h = highPrecision;
  18. Vue.prototype.tidyTpye = (da) => {
  19. switch(da) {
  20. case '1': return "零售专区";
  21. case '2': return "批发专区";
  22. case '3': return "精品专区";
  23. case '4': return "今日值得买";
  24. case '5': return "茶宝兑换";
  25. case '6': return "天天捡漏";
  26. default: return ""
  27. }
  28. }
  29. // 自动适配接口域名
  30. import hosts from "@/request/config";
  31. Vue.prototype.$hosts = hosts;
  32. // 上传
  33. import { up } from "@/utils/up";
  34. Vue.prototype.$up = up;
  35. // 页面跳转
  36. import { goto } from '@/utils/myfun.js';
  37. Vue.prototype.goto = goto;
  38. App.mpType = 'app'
  39. const app = new Vue({
  40. ...App
  41. })
  42. app.$mount()
  43. Array.prototype.indexOf = function (val) {
  44. for (var i = 0; i < this.length; i++) {
  45. if (this[i] == val) return i;
  46. }
  47. return -1;
  48. };
  49. Array.prototype.remove = function (val) {
  50. var index = this.indexOf(val);
  51. if (index > -1) {
  52. this.splice(index, 1);
  53. }
  54. };
  55. Vue.directive('focus', {
  56. inserted: (el, binding) => {
  57. if (binding.value == true || binding.value == undefined) {
  58. el.focus()
  59. }
  60. }
  61. });