35 lines
580 B
JavaScript
35 lines
580 B
JavaScript
import App from './App'
|
|
import http from '@/utils/http'
|
|
|
|
// 挂载到uni对象
|
|
uni.$http = http;
|
|
|
|
// #ifndef VUE3
|
|
import Vue from 'vue'
|
|
import './uni.promisify.adaptor'
|
|
Vue.config.productionTip = false
|
|
App.mpType = 'app'
|
|
|
|
// 挂载到Vue原型
|
|
Vue.prototype.$http = http;
|
|
const app = new Vue({
|
|
...App
|
|
})
|
|
|
|
app.$mount()
|
|
// #endif
|
|
|
|
// #ifdef VUE3
|
|
import { createSSRApp } from 'vue'
|
|
|
|
export function createApp() {
|
|
const app = createSSRApp(App)
|
|
|
|
// 在 Vue 3 中正确挂载 http 到全局属性
|
|
app.config.globalProperties.$http = http;
|
|
|
|
return {
|
|
app
|
|
}
|
|
}
|
|
// #endif
|