import App from './App'
import {
	_router,
	parseRoute
} from '@/utils'
// #ifndef VUE3
import Vue from 'vue'
import __config from 'config/index';
Vue.config.productionTip = false
Vue.prototype.$onLaunched = new Promise(resolve => {
    Vue.prototype.$isResolve = resolve
})
Vue.prototype.baseImagePath = __config.baseImagePath;
App.mpType = 'app'
const app = new Vue({
    ...App
})
Object.defineProperty(Vue.prototype, '$yrouter', {
	get() {
		return _router
	},
})

Object.defineProperty(Vue.prototype, '$yroute', {
	get() {
		return this._route
	},
})
Vue.mixin({
	onLoad() {
		const {
			$mp
		} = this.$root
		this._route = parseRoute($mp)
	},
	onShow() {
		_router.app = this
		_router.currentRoute = this._route
	},
	// 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量
	computed: {
	},
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif