v3tianjin/src/main.ts

42 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import { setupRouter } from "./router";
import axios from "./utils/http/request.ts";
import { setupStore } from "./store/setupStore.ts";
// 引入element
import ElementPlus from "element-plus";
import "element-plus/theme-chalk/index.css";
import "element-plus/dist/index.css";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import "animate.css/animate.min.css";
// 引入pina
import {createPinia} from 'pinia'
// 引入echarts
import echarts from "./utils/echarts";
import { SankeyChart } from "echarts/charts";
echarts.use([SankeyChart]);
const app = createApp(App);
// echarts 挂载到 Vue实例中
app.config.globalProperties.$echarts = echarts; // vue3的挂载方式一个用于注册能够被应用内所有组件实例访问到的全局属性的对象。
// 使用hooks
const store=createPinia()
// 安装插件
app.use(store)
// 路由
setupRouter(app);
// config store.
setupStore(app);
//axios
app.provide("service", axios);
//全局注册图标组件
app.use(ElementPlus, { locale: zhCn });
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
}
app.mount("#app");