main.js模块代码配置
import App from './App'
import {
$http
}
from './common/http.js'
import $common from "@/common/common.js"
import $util from "@/common/util.js"
// #ifndef VUE3
import Vue from 'vue'
// 创建事件总线 就相当于创建了一个新的vue实例
const bus = new Vue()
import './uni.promisify.adaptor'
Vue.config.productionTip = false
Vue.prototype.$http = $http
Vue.prototype.$util = $util
Vue.prototype.$common = $common
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.config.globalProperties.$http = $http
app.config.globalProperties.$util = $util
app.config.globalProperties.$common = $common
return {
app
}
}
// #endif
//域名
$http.baseUrl = 'http://yuanxinyuan.gaojunjun.cn/api/'
$http.baseimgUrl = 'http://yuanxinyuan.gaojunjun.cn/'
$http.beforeRequest = function(options) {
if (!options.data) {
options.data = {}
}
const token = uni.getStorageSync('token')
if (token) {
options.header.XUserToken = token
}
if (options.showLoading) {
uni.showLoading({
title: '加载中...'
})
}
}
$http.afterRequest = function(options) {
uni.hideLoading()
if (options && options.data && options.data.code === 201) {
console.log(options.data.message)
uni.showToast({
title: options.data.message,
icon: 'none'
})
}
}
3***@qq.com (作者)
真机调试运行是可以正常打开的,就是云打包的打开白屏,目前是15、12的系统版本有问题,17 的是可以
2024-02-07 15:36
3***@qq.com (作者)
也没有报错信息
2024-02-07 15:37