租房小程序前端代码
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.

57 lines
1.0 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. import App from './App'
  2. import uvUI from '@/uni_modules/uv-ui-tools'
  3. import { Request } from '@/util/request/index'
  4. import Vue from 'vue'
  5. Vue.config.productionTip = false
  6. // 确保 uvUI 在其他配置之前正确初始化
  7. Vue.use(uvUI)
  8. import './config.js'
  9. import './utils/index.js'
  10. import mixinConfigList from '@/mixins/configList.js'
  11. Vue.mixin(mixinConfigList)
  12. App.mpType = 'app'
  13. try {
  14. function isPromise(obj) {
  15. return (!!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function");
  16. }
  17. // 统一 vue2 API Promise 化返回格式与 vue3 保持一致
  18. uni.addInterceptor({
  19. returnValue(res) {
  20. if (!isPromise(res)) {
  21. return res;
  22. }
  23. return new Promise((resolve, reject) => {
  24. res.then((res) => {
  25. if (res[0]) {
  26. reject(res[0]);
  27. } else {
  28. resolve(res[1]);
  29. }
  30. });
  31. });
  32. },
  33. });
  34. } catch (error) {}
  35. import store from '@/store'
  36. Vue.prototype.$store = store
  37. // 初始化 HTTP 请求配置
  38. Request()
  39. const app = new Vue({
  40. ...App,
  41. store
  42. })
  43. app.$mount()