You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.6 KiB
TypeScript

import { createApp } from 'vue';
import App from './App.vue';
import './assets/main.css';
import MyButton from '@/components/test/my-button/index.vue';
import MyInput from '@/components/test/my-input/index.vue';
import CustomDemo from '@/components/test/custom-demo/index.vue';
import PieCharts from '@/components/test/pie-charts/index.vue';
import ElementPlus from 'element-plus';
import { createPinia } from 'pinia';
import 'element-plus/dist/index.css';
import router from './router/newIndex';
import '@/utils/globalUtils';
import { stompService } from '@/utils/stompService';
// 导入 Element Plus 语言包
// import enLocale from 'element-plus/dist/locale/en.mjs';
import '@/styles/index.scss';
// 暗黑模式
import 'element-plus/theme-chalk/dark/css-vars.css';
// import zhCnLocale from 'element-plus/dist/locale/zh-cn.mjs';
// main.ts 或入口文件
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
const app = createApp(App);
const pinia = createPinia();
// 全局注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component);
}
// // 创建自定义英文语言包 - 修改分页文本
// const customEnLocale = {
// ...enLocale,
// el: {
// ...enLocale.el,
// pagination: {
// ...enLocale.el.pagination,
// goto: 'Go to',
// pagesize: '/page', // 修改这里:去掉空格,改为 /page
// total: 'Total {total}',
// pageClassifier: '' // 设置为空字符串,避免默认的 " items"
// }
// }
// };
// // 创建自定义中文语言包 - 修改分页文本
// const customZhCnLocale = {
// ...zhCnLocale,
// el: {
// ...zhCnLocale.el,
// pagination: {
// ...zhCnLocale.el.pagination,
// goto: '前往',
// pagesize: '/页', // 修改为 /页
// total: '共 {total} 条',
// pageClassifier: '' // 设置为空,去掉默认的 " 条"
// }
// }
// };
// 使用自定义英文语言包(你可以根据需要选择中文或其他语言)
app.use(ElementPlus, {
// locale: customEnLocale // 使用自定义英文
// locale: customZhCnLocale // 如果要使用中文,取消注释这行并注释上面的
});
app.use(router);
app.use(pinia);
app.use(ElementPlus);
app.component('my-input', MyInput);
app.component('my-button', MyButton);
app.component('custom-demo', CustomDemo);
app.component('pie-charts', PieCharts);
// 项目启动时自动连接 STOMP/MQTT
stompService.connect({
reconnectDelay: 5000 // 5 秒后重连
});
console.log('[Main] STOMP/MQTT 服务已启动,正在连接...');
app.mount('#app');