45 lines
746 B
JavaScript
45 lines
746 B
JavaScript
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
|