兼兼街租房小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
858 B

  1. import Vue from 'vue';
  2. import App from './App';
  3. import request from '@/common/axios.js';
  4. import tokenUtil from '@/common/token.js';
  5. Vue.config.productionTip = false;
  6. Vue.prototype.$request = request;
  7. Vue.prototype.$tokenUtil = tokenUtil;
  8. Vue.prototype.$token = tokenUtil.token;
  9. Vue.prototype.$user = tokenUtil.user;
  10. Vue.mixin({
  11. methods: {
  12. setData: function(obj) {
  13. let that = this;
  14. let keys = [];
  15. let val, data;
  16. Object.keys(obj).forEach(function(key) {
  17. keys = key.split('.');
  18. val = obj[key];
  19. data = that.$data;
  20. keys.forEach(function(key2, index) {
  21. if (index + 1 == keys.length) {
  22. that.$set(data, key2, val);
  23. } else {
  24. if (!data[key2]) {
  25. that.$set(data, key2, {});
  26. }
  27. }
  28. data = data[key2];
  29. })
  30. });
  31. }
  32. }
  33. });
  34. App.mpType = 'app';
  35. const app = new Vue({
  36. ...App
  37. });
  38. app.$mount();