mirror of https://github.com/halo-dev/halo-admin
perf: optimize the code of main.ts
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/581/head
parent
887f3ee4d2
commit
b9f5d4fb6b
23
src/main.ts
23
src/main.ts
|
@ -1,28 +1,17 @@
|
||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import { createPinia } from "pinia";
|
import { createPinia } from "pinia";
|
||||||
|
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
import router from "./router";
|
import router from "./router";
|
||||||
import "@halo-dev/components/dist/style.css";
|
|
||||||
import "@/styles/tailwind.css";
|
|
||||||
import { Dropdown, Menu, Tooltip, VClosePopper, VTooltip } from "floating-vue";
|
|
||||||
import "floating-vue/dist/style.css";
|
|
||||||
// @ts-ignore
|
|
||||||
import VueGridLayout from "vue-grid-layout";
|
|
||||||
import Widgets from "@/views/dashboard/widgets";
|
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
|
// setup
|
||||||
|
import "./setup/setupStyles";
|
||||||
|
import { setupComponents } from "./setup/setupComponents";
|
||||||
|
|
||||||
|
setupComponents(app);
|
||||||
|
|
||||||
app.use(createPinia());
|
app.use(createPinia());
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(VueGridLayout);
|
|
||||||
app.use(Widgets);
|
|
||||||
|
|
||||||
app.directive("tooltip", VTooltip);
|
|
||||||
app.directive("close-popper", VClosePopper);
|
|
||||||
|
|
||||||
app.component("FloatingDropdown", Dropdown);
|
|
||||||
app.component("FloatingTooltip", Tooltip);
|
|
||||||
app.component("FloatingMenu", Menu);
|
|
||||||
|
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import type { App } from "vue";
|
||||||
|
import { Dropdown, Menu, Tooltip, VClosePopper, VTooltip } from "floating-vue";
|
||||||
|
import "floating-vue/dist/style.css";
|
||||||
|
// @ts-ignore
|
||||||
|
import VueGridLayout from "vue-grid-layout";
|
||||||
|
import Widgets from "@/views/dashboard/widgets";
|
||||||
|
|
||||||
|
export function setupComponents(app: App) {
|
||||||
|
app.use(VueGridLayout);
|
||||||
|
app.use(Widgets);
|
||||||
|
|
||||||
|
app.directive("tooltip", VTooltip);
|
||||||
|
app.directive("close-popper", VClosePopper);
|
||||||
|
app.component("FloatingDropdown", Dropdown);
|
||||||
|
app.component("FloatingTooltip", Tooltip);
|
||||||
|
app.component("FloatingMenu", Menu);
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
import "@halo-dev/components/dist/style.css";
|
||||||
|
import "@/styles/tailwind.css";
|
Loading…
Reference in New Issue