import * as Pinia from 'pinia'
import uviewPlus from 'uview-plus'
import { createSSRApp } from 'vue'
import App from './App.vue'
import './colorconfig.scss'

export function createApp() {
  const app = createSSRApp(App)

  // uview-plus
  app.use(uviewPlus)

  // onLaunch 同步阻塞
  app.config.globalProperties.$onLaunched = new Promise(resolve => {
    app.config.globalProperties.$isResolve = resolve
  })

  // pinia
  app.use(Pinia.createPinia())

  return {
    app,
    Pinia
  }
}
