import App from './App'
import uviewPlus from '@/uni_modules/uview-plus'
import './framework/bootstrap'
import config from '@/common/config.js'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from "vue";
import * as Pinia from 'pinia';
import {
	createUnistorage
} from './uni_modules/pinia-plugin-unistorage';


export function createApp() {
	// 创建 SSR 应用实例
	const app = createSSRApp(App);
	// 创建 Pinia 实例
	const store = Pinia.createPinia();
	// 应用 Pinia 持久化插件
	store.use(createUnistorage());
	// 使用 Pinia 状态管理
	app.use(store);
	// 使用 uviewPlus 插件
	app.use(uviewPlus);
	// 配置 $onLaunched 全局属性
	app.config.globalProperties.$onLaunched = new Promise((resolve) => {
		app.config.globalProperties.$isResolve = resolve;
	});
	return {
		app,
		Pinia,
	};
}
// #endif