import App from './App' // vuex import store from '@/store/index.js' // uviewPlus导入 - 注意 Vue3 的特殊导入方式 // #ifdef VUE3 import uviewPlus from 'uview-plus' // #endif // #ifndef VUE3 import uviewPlus from '@/uni_modules/uview-plus' // #endif import bootstrap from './core/bootstrap' import { isLogin, isEmpty, navTo, getRegistrationID, parsePhone } from '@/utils/util.js' // 全局 mixin import share from './core/mixins/share.js' import mixin from './core/mixins/app' // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' // 配置 uView Plus Vue.use(uviewPlus) // 配置 Vuex Vue.use(store) Vue.config.productionTip = false // 全局属性 Vue.prototype.$img = { img: '/static/images/img.png', logo: '/static/images/logo.png', } Vue.prototype.$isLogin = isLogin Vue.prototype.$isEmpty = isEmpty Vue.prototype.$navTo = navTo Vue.prototype.$getRegistrationID = getRegistrationID Vue.prototype.$parsePhone = parsePhone // 全局 mixin Vue.mixin(share) Vue.mixin(mixin) App.mpType = 'app' // 初始化 bootstrap().then(() => { const app = new Vue({ store, // 注入 store ...App }) app.$mount() }) // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' export function createApp() { const app = createSSRApp(App) // 注册 uView Plus (Vue3 方式) app.use(uviewPlus) // 注册 Vuex app.use(store) app.config.productionTip = false // 定义全局属性 app.config.globalProperties.$img = { img: '/static/images/img.png', logo: '/static/images/logo.png', } app.config.globalProperties.$isLogin = isLogin app.config.globalProperties.$isEmpty = isEmpty app.config.globalProperties.$navTo = navTo app.config.globalProperties.$getRegistrationID = getRegistrationID app.config.globalProperties.$parsePhone = parsePhone // 全局 mixin app.mixin(share) app.mixin(mixin) // 初始化 return { app, created: bootstrap } } // #endif