import { createSSRApp } from 'vue' import * as Pinia from 'pinia' // @ts-ignore import uView from 'vk-uview-ui' import App from './App.vue' import comMessage from '@/mycomponents/common/comMessage.vue' import tab from './plugins/tab' import modal from './plugins/modal' import time from './plugins/time' import storage from './plugins/storage' // unocss import 'uno.css' import { accessTimeInAnHour, getNowFormatDate } from "./utils/dateTime"; export function createApp() { const app = createSSRApp(App) app.use(Pinia.createPinia()) app.use(uView) // 解决onLaunch和onLoad异步问题 app.config.globalProperties.$onLaunched = new Promise(resolve => { app.config.globalProperties.$isResolve = resolve }) // 页签操作 app.config.globalProperties.$tab = tab // 模态框对象 app.config.globalProperties.$modal = modal // 时间对象 app.config.globalProperties.$time = time // 缓存 app.config.globalProperties.$storage = storage app.component('com-message', comMessage) return { app, // uni-app 官方文档示例 https://zh.uniapp.dcloud.io/tutorial/vue3-pinia.html#%E7%8A%B6%E6%80%81%E7%AE%A1%E7%90%86-pinia Pinia // 此处必须将 Pinia 返回 } }