import { defineComponent } from "vue";
import { Provider } from "queenjs/adapter/vue";
import { Router } from "vue-router";
import { createApp } from "vue";
import { queenApi } from "queenjs";
import "windi.css";
import "@/styles/global.less";
let setModuleHooks: any[] = [];

const App = defineComponent(() => {
  setModuleHooks.forEach((hook) => hook());
  setModuleHooks = [];
  return () => (
    <Provider>
      <router-view></router-view>
    </Provider>
  );
});

export function startApp(router: Router, hooks: any[] = []) {
  setModuleHooks = hooks;
  queenApi.router = router;
  createApp(App).use(router).mount("#app");
}
