39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
import { createApp } from "vue";
|
|
import router from "./router/index.js";
|
|
import App from "./App.vue";
|
|
import ElementPlus from "element-plus";
|
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
import "element-plus/dist/index.css";
|
|
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
|
import store from "./store";
|
|
|
|
// let matchMedia = window.matchMedia("(prefers-color-scheme: light)");
|
|
// setDarkMode(matchMedia.matches);
|
|
// matchMedia.addEventListener("change", function () {
|
|
// console.log(`当前的主题是:${this.matches ? "light" : "dark"}`);
|
|
// setDarkMode(this.matches);
|
|
// });
|
|
|
|
// // 设置主题模式
|
|
// function setDarkMode(flag) {
|
|
// if (flag) {
|
|
// document.querySelector("#html").classList.add("light");
|
|
// document.querySelector("#html").classList.remove("dark");
|
|
// } else {
|
|
// document.querySelector("#html").classList.add("dark");
|
|
// document.querySelector("#html").classList.remove("light");
|
|
// }
|
|
// }
|
|
|
|
const app = createApp(App);
|
|
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
app.component(key, component)
|
|
}
|
|
|
|
app.use(router);
|
|
app.use(store);
|
|
app.use(ElementPlus, { locale: zhCn });
|
|
app.mount("#app");
|