import App from './App'
import tool from './util/tool.js'
// 设置env配置文件
import envConfig from '@/env/config.js'
// 全局配置项
import appConfig from '@/config/appConfig.js'

import storageManage from '@/util/storageManage.js'
import JLoading from './components/newComponents/JLoading/JLoading.vue'
// import index from './pages/workbench/workbench.vue'
import { hideLoading, showLoading } from './hooks/loading'

// 设置node环境
envConfig.changeEnv(storageManage.env())

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})

app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	console.log(app);
	// app.config.globalProperties.$mpName = mpInfo.miniprogram.nickName || ''
	app.config.globalProperties.$tool = tool
	app.config.globalProperties.appConfig = appConfig
	app.config.globalProperties.showLoading = showLoading
    app.config.globalProperties.$appName = appConfig.appName
    uni.$appName = appConfig.appName
	app.component('JLoading', JLoading)
	return {
		app
	}
}
// #endif
