import App from './App' // #ifndef VUE3 import Vue from 'vue' Vue.prototype.host = "https://jiajumall.scdxtc.cn" Vue.config.productionTip = false import pageHead from './component/pageHead.vue' Vue.component('page-head',pageHead) Vue.prototype.request =async ({url = '', type = '', data = {}, success}) => { if(uni.getStorageSync('userData')){ let userData=uni.getStorageSync('userData') uni.request({ method: type, url:url, data: data, success: success, header: { "Authorization":"Bearer "+userData.token, }, complete: (res) => { } }) }else{ uni.request({ method: type, url:url, data: data, success: success, complete: (res) => { } }) } } Vue.prototype.requestToken =async ({url = '', type = '', data = {}, success,contentType="application/x-www-form-urlencoded"}) => { if(uni.getStorageSync('userData')){ let userData=uni.getStorageSync('userData') uni.request({ method: type, url:url, data: data, header: { "Authorization":"Bearer "+userData.token, 'content-type': contentType }, success: success, complete: (res) => { console.log(res) } }) }else{ uni.redirectTo({ url: '/pages/index/login' }); } } App.mpType = 'app' const app = new Vue({ ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) return { app } } // #endif