rentease-app/main.js

45 lines
746 B
JavaScript
Raw Permalink Normal View History

2026-04-20 06:23:11 +00:00
import App from './App'
// 引入 API 和工具
import api from './api/index.js'
import utils from './utils/index.js'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
// 将 API 挂载到 Vue 原型
Vue.prototype.$api = api
// 将工具函数挂载到 Vue 原型
Vue.prototype.$utils = utils
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
// 将 API 挂载到全局属性
app.config.globalProperties.$api = api
// 将工具函数挂载到全局属性
app.config.globalProperties.$utils = utils
return {
app
}
}
// #endif