You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.0 KiB
66 lines
2.0 KiB
import { createApp } from 'vue' |
|
// import G6 from '@antv/g6' |
|
// 导入svg插件 |
|
import 'virtual:svg-icons-register' |
|
import App from './App.vue' |
|
// 引入elementplus组件库 |
|
import ElementPlus from 'element-plus' |
|
// 样式; |
|
import 'element-plus/dist/index.css' |
|
//@ts-expect-error忽略当前文件ts类型的检测否则有红色提示(打包会失败) |
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' |
|
import gloablComponent from './components/index' |
|
// 引入全局样式 |
|
import '@/styles/index.scss' |
|
import 'element-plus/theme-chalk/dark/css-vars.css' // 引入Element Plus暗黑主题 |
|
import './styles/dark.scss' // 引入自定义暗黑主题 |
|
import themeStore from './store/module/theme' |
|
|
|
// 引入仓库 |
|
import { createPinia } from 'pinia' |
|
// 引入路由 |
|
import router from './permissions' |
|
import '@/utils/rem.js' |
|
import defaultImage from '@/directives/defaultImage' |
|
// 创建vue实例 |
|
const app = createApp(App) |
|
const pinia = createPinia() |
|
|
|
// 注册全局指令 |
|
app.directive('default-image', defaultImage) |
|
// 注册element plus组件库 |
|
app.use(ElementPlus, { |
|
locale: zhCn, |
|
}) |
|
|
|
// 注册全局组件 |
|
app.use(gloablComponent) |
|
app.use(router) |
|
app.use(pinia) |
|
|
|
// app.use(G6) |
|
// 挂载点 |
|
app.mount('#app') |
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
|
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
|
app.component(key, component) |
|
} |
|
|
|
// 初始化主题 |
|
const useThemeStore = themeStore() |
|
useThemeStore.initTheme() |
|
const ua = navigator.userAgent.toLowerCase() |
|
const isMobile = /iphone|android|ipad|mobile/.test(ua) |
|
|
|
const currentHost = location.host |
|
const mobileHost = new URL(import.meta.env.VITE_APP_MOBILE_URL).host |
|
const pcHost = new URL(import.meta.env.VITE_APP_PC_URL).host |
|
|
|
if (isMobile && currentHost !== mobileHost) { |
|
console.log('手机端,跳转到移动站') |
|
location.href = import.meta.env.VITE_APP_MOBILE_URL |
|
} else if (!isMobile && currentHost !== pcHost) { |
|
console.log('电脑端,跳转到 PC 站') |
|
location.href = import.meta.env.VITE_APP_PC_URL |
|
}
|
|
|