|
|
|
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()
|
|
|
|
|
|
|
|
// console.log(ua,'ua');
|
|
|
|
|
|
|
|
const isMobile = /iphone|android|ipad|mobile/.test(ua)
|
|
|
|
|
|
|
|
if (isMobile) {
|
|
|
|
console.log('手机端')
|
|
|
|
|
|
|
|
} else if (!isMobile) {
|
|
|
|
console.log('电脑端')
|
|
|
|
}
|