import App from './App' import Store from './store' // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) app.use(Store) //新增的一行 return { app } } // #endif import { $http } from './api/http.js' // import { login } from './api/api' uni.$http = $http $http.baseUrl = '' // uni.$apiKey = 'xxxxxxxxx' // 请求开始之前 $http.beforeRequest = function (options) { // uni.showLoading({ // title: '数据加载中...', // }) // if(options.url!="http://10.168.4.100:80/api/v1/login"){ // console.log(options); // if (!uni.getStorageSync('token')) { // login().then(data => { // // console.log(data); // if (data.status == 'ok') { // uni.setStorage({ // key: 'token', // data: data.data.token, // success: function(res) { // console.log(res); // } // }); // }else{ // uni.showToast({ // title:data.msg, // icon: 'none', // duration: 2000, // 显示时长,单位为毫秒 // }); // } // }); // } // } } // 请求完成之后 $http.afterRequest = function () { // uni.hideLoading() }