新建http文件夹。在建http.js,在http/http.js
const baseUrl = 'http://www.fgfw.com:9080';
export default {
baseUrl
}
在main.js中引入
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import http from './http/http.js'
Vue.prototype.$http = http
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
完成